dynamically changing the position attribute for popup and menupopup elements causes the popup to be displayed in the wrong location




10 years ago
8 years ago


(Reporter: sdb, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [CLOSEME 2010-11-15])


(2 attachments)



10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080404 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080404 Firefox/

Let's say you have one menupopup element that you're using as the context menu for both a toolbar button and a statusbar icon.  Since the statusbar icon is at the bottom of your browser's window the position attribute needs to be set as before_start.  And if the toolbar button is at the top right of your window the position attribute needs to be set as after_end.  So to accomplish that you would dynamically change the position attribute when the onpopupshowing event was fired.  Unfortunately when you try to dynamically change the position attribute it causes the popup to appear in the wrong location on the screen the first time it's displayed.  Consecutive attempts to access the context menu result in the popup being displayed in the proper location.  First click = wrong location.  Second click = right location.  I've tried removing the attribute before setting the new value just to see if that made any difference but this bug occurs either way.

Reproducible: Always

Steps to Reproduce:
1. Install the cookiesafe extension attached to this page. Please note that this is not a polished version and is only meant for testing purposes.
2. Make sure the cookiesafe icon is displayed on the statusbar panel.  If not open the CS options window and enable the statusbar icon.
3. Right click on the toolbar and click Customize.  Drage the cookiesafe button onto the far right edge of the toolbar.
4. Right click on the CS statusbar icon.
5. Right click on the CS toolbar button.  Note that the popup appeared at the bottom of the window.  Right click on the toolbar button again.  Now the popup appears in the correct location.
6. Right click on the CS statusbar icon.  Note that the popup appears with the right edges aligned.  Right click on the statusbar icon again.  Now the popup appears centered over the CS icon.

Expected Results:  
When right clicking on the toolbar button the right edges of the button and popup should be aligned.  When right clicking on the statusbar icon the left edges (or if there's not enough space it will be centered) of the icon and popup should be aligned.

Comment 1

10 years ago
Created attachment 321299 [details]
this extension will allow you to reproduce the bug. it is for testing purposes only.

Comment 2

10 years ago
Created attachment 321313 [details]
this attached extension will create a 'too much recursion' error to occur in chrome://global/content/bindings/popup.xml

Comment 3

10 years ago
Well I seem to have stumbled on another bug involving the menupopup position.  I've tried every conceivable solution to fix this problem including manually showing the popup.  However doing so has resulted in another bug which I'll post here just in case it's related to the original one.  You can verify this bug by installing the second attachment above (321313) and right clicking on the CS toolbar icon.

As a test I added a popupanchor and popupalign attribute to both the CS toolbar and statusbar elements in the overlay.  I also changed the onpopupshowing event on the menupopup to send the event as an argument to the cookiesafe.populateMenu() method.  When the event is received the default behavior is canceled with ev.preventDefault().  I've also tried using the popup.hidePopup() method to make sure that the onpopupshowing event was canceled and popup was hidden which resulted in the same error.  The populateMenu method then changes the position attribute based on whether it's being displayed for the statusbar or toolbar.  Then at the bottom of that method I used the popup.showPopup() method to display the popup.  The following error is then displayed multiple times in the Error Console.

Error: too much recursion
Source File: chrome://global/content/bindings/popup.xml
Line: 67

popupBox.showPopup(element, this, xpos, ypos, popuptype, anchoralignment, popupalignment);
This bug was reported using Firefox 3.0 or older, which is no longer supported. The bug has also not been changed in over 500 days and is still in UNCO.
Reporter, please retest this bug in Firefox 3.6.10 or later using a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles. If you still see this problem, please update the bug. If you no longer see the bug, please set the resolution to RESOLVED, WORKSFORME.

This is a mass search of unconfirmed bugs that have no activity on them, so if you feel a bug was marked in error, just remove the CLOSEME comment in the whiteboard within the next month.
Whiteboard: [CLOSEME 2010-11-15]
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.