A panel is a used as a temporary floating popup window that may contain any type of content. It does not have any window decorations. When open, it floats above the window and may extend outside the border of the main window. Typically, it will be attached to a button using the button's type
attribute so that when the button is pressed, the panel will be displayed. A panel may also be opened via a script using the openPopup
method.
The panel is closed when the user clicks outside the panel, presses Escape or when the panel's hidePopup
method is called.
iframe
, browser
or editor
inside a panel is not supported. Some features may work, but only on some platforms. For those versions of Firefox, it is best to avoid child frames in a panel, if possible. This limitation was resolved as of Firefox 4.0.The following example shows how a panel may be attached to a label.
<panel id="thepanel"> <hbox align="start"> <image src="warning.png"/> <vbox> <description value="You have 6 new messages."/> <hbox> <button label="Read Mail"/> <button label="New Message"/> </hbox> </vbox> </hbox> </panel> <description value="6 New Messages" popup="thepanel"/>
backdrag
backdrag
attribute on a XUL panel lets the user move the panel by clicking and dragging anywhere on its background area.close
true
to have a close button appear on the titlebar. Pressing the close button will close the panel.consumeoutsideclicks
true
the rollup event is consumed. If set to false
, the rollup event is not consumed. This attribute should be used instead of setConsumeRollupEvent
.fade
fade
attribute, which may only be used with arrow panels, lets you set up a panel that will automatically fade away after a short time. The default is none
.none
slow
fast
flip
both
, permits that behavior. You will not normally have to use this attribute, since it's automatically applied to arrow panels.slide
, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. A sliding panel will have the start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor.flip="slide"
and has a width which is greater than the distance from the anchor to the right of the screen (or window), so the panel extends past the left of the anchor, and the arrow slides towards the middle of the panel such that it is still aligned with the anchor. Without flip="slide"
, the panel would have had its width truncated and the panel would not extend to the left of the anchor.ignorekeys
false
, the default value, the Escape key may be used to close the panel. If true
, the Escape key cannot be used to close the panel.label
level
top
, otherwise, the default value is parent
. If a panel has one or more text fields, this attribute should not be set, otherwise IME or on-screen keyboard popups will appear incorrectly. For these reasons, you should avoid setting the level if not needed.top
parent
floating
noautofocus
noautohide
false
, the default value, the panel will be hidden when the user clicks outside the panel or switches focus to another application. If true
, the panel will only be closed when the hidePopup method is called.norestorefocus
false
, the default value, then when the panel is hidden, the keyboard focus will be restored to whatever had the focus before the panel was opened. If true
, the focus will not be reset, although it will be cleared if the focus is within the panel.onpopuphiding
onpopupshowing
false
from this event handler prevents the popup from appearing.onpopupshown
onload
event is sent to a window when it is opened.position
position
attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the popup on one side of a button. Note that a context menu will never respect this attribute, always appearing relative to the mouse cursor.topleft
, topright
, bottomleft
, bottomright
, leftcenter
, rightcenter
, topcenter
or bottomcenter
. The popup value (ie, the second word) can be one of topleft
, topright
, bottomleft
or bottomright
.after_start
, after_end
, before_start
, before_end
, end_after
, end_before
, start_after
, start_before
, overlap
, at_pointer
or after_pointer
.titlebar
normal
to display a panel with a titlebar. The noautohide
attribute must be set to true
.type
autocomplete
autocomplete-richlistbox
arrow
drag
accessibleType
popupBoxObject
nsIPopupBoxObject
nsIPopupBoxObject
that implements the popup. You wouldn't normally need to use this property as all of its functions are available via the popup itself.state
closed
: The popup is closed and not visible.open
: The popup is open and visible on screen.showing
: A request has been made to open the popup, but it has not yet been shown. This state will occur during the popupshowing event.hiding
: The popup is about to be hidden. This state will occur during the popuphiding event.hidePopup()
moveTo( x, y )
openPopup( anchor , position , x , y , isContextMenu, attributesOverride, triggerEvent )
Opens the popup relative to a specified node at a specific location.
null
as the anchor node. The direction in which the popup is oriented depends on the direction of the anchor.before_start
, before_end
, after_start
, after_end
, start_before
, start_after
, end_before
, end_after
, overlap
, and after_pointer
. Check Positioning of the Popup Guide for a precise description of the effect of the different values.x
and y
arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the position
and attributesOverride
arguments are ignored.isContextMenu
argument should be true
for context menus and false
for all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.attributesOverride
argument is true
, the position attribute on the popup node overrides the position
value argument. If attributesOverride
is false
, the attribute is only used if the position
argument is empty.openPopupAtScreen( x, y, isContextMenu )
sizeTo( width, height )
nsIAccessibleProvider
, nsIDOMXULPopupElement