I have a Firefox extension that adds a button to the toolbar (navbar to be exact). When the button is pressed, a XUL <panel>
(which is a child element of the button) is opened with an <iframe>
embedded in it. An HTML document is loaded into the panel to display the contents of the popup.
If the HTML contains an input field, I would not expect keypress
events in that field to bubble up the DOM. However, they do bubble up to the <panel>
that contains the embedded iframe and thereforth up to the toolbar button. Any idea why the panel gets the events even though they should be captured and processed by the HTML elements in the embedded browser?
type="content"
, did you? Note that input fields handlekeypress
events by merely callingpreventDefault()
, they don't stop event propagation. – Wladimir Palanttype
of the iframe ischrome
in this case, since we need the HTML document to have elevated privileges. Are you saying that the propagation behavior is different in this case? – Matthew Gertnerkeypress
events at the<panel>
level) is correct. – Matthew Gertnertype="content"
is exactly what stops events from being propagated from the frame to the container document. Note that it has nothing to do with privileges, the document loaded into the frame can have elevated privileges regardless. Also: yes, stopping propagation of the events at a higher level is the usual solution. – Wladimir Palant