Closed Bug 859126 Opened 12 years ago Closed 11 years ago

Mouse scrolling of long menus breaks if the last item is hidden via display:none

Categories

(Toolkit :: UI Widgets, defect)

1.9.2 Branch
x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: mozilla, Assigned: alice0775)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0 Build ID: 20130107124423 Steps to reproduce: 1. Hide the last item of the bookmarks menu (eg: set menu_unsortedBookmarks to display: none in CSS). 2. Add enough bookmarks that scroll arrows appear on the menu. 3. Open bookmarks menu and twirl the mouse wheel. Actual results: 1. Nothing. Expected results: 1. The menu should scroll to show items which didn't fit on the screen. Seems like this applies to all scrollboxes but I tested it with the bookmarks menu. Adding non-blank items to the end of the menu makes scrolling work again, even invisible ones such as a zero-size spacer or a collapsed item. Scrolling by hovering on the arrows works, this is scrollByPixel() rather than scrollByItem(). Should they both be the same?
Component: Untriaged → Bookmarks & History
Attached file sample xul
you should use visibility:collapse instead of display:none.
Component: Bookmarks & History → XUL
OS: Linux → All
Product: Firefox → Core
Version: 17 Branch → 1.9.2 Branch
Regression window: Good: http://hg.mozilla.org/mozilla-central/rev/68cfe7fb9f31 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2a1pre) Gecko/20090413 Minefield/3.6a1pre ID:20090413045916 Bad: http://hg.mozilla.org/mozilla-central/rev/68d9acc70491 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2a1pre) Gecko/20090414 Minefield/3.6a1pre ID:20090414100052 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=68cfe7fb9f31&tochange=68d9acc70491 Suspected: Bug 487946
Blocks: 487946
This triggered by 10528984d5fd Dão Gottwald — Bug 487982 - arrowscrollbox.scrollByIndex fails if there are gaps between the elements. r=enn
Blocks: 487982
No longer blocks: 487946
Component: XUL → XUL Widgets
Product: Core → Toolkit
(In reply to Alice0775 White from comment #1) > you should use visibility:collapse instead of display:none. "visibility:collapse" is not a suitable alternative to "display: none" in this case. Menuitems with "visibility: collapse" can still be tabbed to and can still be activated using the keyboard, causing much confusion since they are invisible.
Attached patch possible fixSplinter Review
cannot scroll to 'display:none' element
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 734579 [details] [diff] [review] possible fix _canScrollToElement is called pretty frequently, so if we want to take this patch we need to make sure it doesn't perform significantly worse.
See Also: → 984156
Attachment #734579 - Attachment is obsolete: true
Blocks: 984156
Comment on attachment 734579 [details] [diff] [review] possible fix I think this is probably ok performance-wise, as the code calling _canScrollToElement flushes layout anyway and layout shouldn't get dirty again between successive _canScrollToElement calls. > <method name="_canScrollToElement"> > <parameter name="element"/> >- <body> >- return !element.hidden; >- </body> >+ <body><![CDATA[ >+ return !element.hidden && >+ window.getComputedStyle(element, null).getPropertyValue("display") != "none"; >+ ]]></body> > </method> The !element.hidden check can be dropped.
Attachment #734579 - Attachment is obsolete: false
Attachment #734579 - Flags: review+
Assignee: nobody → alice0775
Summary: Mouse scrolling of long menus breaks if the last item is hidden → Mouse scrolling of long menus breaks if the last item is hidden via display:none
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: