Closed
Bug 1000424
Opened 10 years ago
Closed 10 years ago
BUttons in new menu panel cannot be retrieved on window load
Categories
(Firefox :: Toolbars and Customization, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: realRaven, Unassigned)
References
(Blocks 1 open bug)
Details
I do some customization with my new uiPanel button for my Addon QuickPasswords. Problem is when the button is configured to be within the new uiPanel, getElementById cannot find it. it works for everything else and also for the button if it is in the main toolbar.
Reporter | ||
Comment 1•10 years ago
|
||
I have tried to move the code that looks for this button to an observer on browser-delayed-startup-finished but it is still the same: all other buttons, menu items etc are found via getElementById but the button cannot be found. I seem to have to use it at least once so that it can be discovered?
Updated•10 years ago
|
Blocks: australis-cust
Reporter | ||
Comment 2•10 years ago
|
||
Looks like this is "by design". I have coded the workaround using a toolbar observer on the CustomizableUI interface through the onWidgetAfterDOMChange event: const { CustomizableUI } = Components.utils.import("resource:///modules/CustomizableUI.jsm", {}); if (CustomizableUI) CustomizableUI.addListener(QuickPasswords.ToolbarListener); QuickPasswords.ToolbarListener = { onWidgetAfterDOMChange: function (node, nextNode, container) { if (node && node.id === 'QuickPasswords-toolbar-button') { node.classList.toggle('australis', QuickPasswords.Preferences.getBoolPref('skin.australis')); QuickPasswords.initToolbarLock(null, node); } } }
Comment 3•10 years ago
|
||
Use getWidget() instead of the observer stuff. It's a duplicate of bug 941903.
Comment 4•10 years ago
|
||
This is documented on the Australis add-on compatibility page[1] of MDN, linked from the Firefox 29 for developers page. Many add-ons check whether their button is in the toolbox (rather than in a toolbar or some other visible place) by checking the result of document.getElementById(). This is no longer enough. If your button is in the menu panel, it will not be moved there until the menu panel is first shown. Instead, use: CustomizableUI.getPlacementOfWidget("mytoolbarbuttonId") This will return null if and only if the widget is in the palette. Please use getWidget or getPlacementOfWidget instead. [1] https://developer.mozilla.org/en-US/Firefox/Australis_add-on_compat#Known_issues_related_to_add-ons
You need to log in
before you can comment on or make changes to this bug.
Description
•