0
votes

i added the example from MDN of a menulist to an iframe inside a panel in my firefox extension,

<menulist>
  <menupopup>
    <menuitem label="option 1" value="1"/>
    <menuitem label="option 2" value="2"/>
    <menuitem label="option 3" value="3"/>
    <menuitem label="option 4" value="4"/>
  </menupopup>
</menulist>

but when i click it, the iframe reloads. Is there something that i have to do to make it stop reloading?

-- EDIT:

I created a simple xul file and put the above code and it works as expected, so the problem is in my surrounding code.

This is a panel with an iframe inside, that i open when i click a button:

<button id="bannerLeftOffers"
        class="leftIconsImage"
        type="panel">
    <panel id="offers-panel"
           type="arrow"
           noautofocus="true"
           consumeoutsideclicks="false"
           noautohide="true"
           onpopupshowing="offer.start();">
        <hbox id="offers-panel-container" align="top">
            <iframe id="offers-iframe" flex="1"/>
        </hbox>
    </panel>
</button>

Whenever i click the menulist, the function "offer.start();" is called, but i don't have any other calls for that function, just on the panel onpopupshowing, so i guess that some event on the menulist might be triggering the reload, but i don't know what it is.

1
kindly post your xul file.Snehal Patel
It is a huge file, i don't think it would help a lot. I'm going to add some information i gathered to the main question.Filipe Silva

1 Answers

0
votes

I fixed this problem with the following:

adding

offer.open = false

then on the onpopupshowing function "start", added:

if (offer.open == false) 
...
Load popup content
offer.open = true;

then added a function to onpopuphiding to set the variable to false again;

This way the panel doesn't reload and the menulist works as expected.

-- EDIT:

Turns out it doesn't fix the problem completely. I can click on the menulist and it shows the options (wich i couldn't see before), but if i click it again, the panel hides and shows again, rendering this solution useless...

-- EDIT 2:

I think i found another solution.

I am checking if the explicitOriginalTarget.id that triggered the offers.start(event) is the offers-panel. If it is, i load the panel. otherwise i do nothing.

I'm not sure what triggers the reload of the panel/iframe, but this fixes that behavior