Page MenuHomePhabricator

FloatingMenuSelectWidget with an overlay jumps to the position of the overlay if an item is selected
Closed, ResolvedPublic

Description

I can reproduce this in Firefox 52.0.2 and Chromium 57.0.2987.98.

To reproduce:

  1. Open the demo page.
  2. Find the "DropdownWidget (using overlay)‎" demo.
  3. Select one of the options in the widget.
  4. Click the widget again.
    • At this point, it will jump to the top of the page.

This seems to have been caused by rGOJUc40a55f1ecb5: MenuSelectWidget: Ensure currently selected element is visible when menu opens which added a scrollElementIntoView() call into MenuSelectWidget in a place that gets called before FloatingMenuSelectWidget positions the dropdown on screen, The comment here seems apropos.

I don't know if it's the best solution, but I find that sticking that scrollElementIntoView inside a 0-delay setTimeout() fixes it.

Event Timeline

Yeah, this is a mess. I don't know what the best solution is either, but your proposed workaround seems okay.

Change 348799 had a related patch set uploaded (by Bartosz Dziewoński):
[oojs/ui@master] MenuSelectWidget: Workaround for scrolling to top of page for dropdowns with $overlay

https://gerrit.wikimedia.org/r/348799

Change 350479 had a related patch set uploaded (by Bartosz Dziewoński):
[oojs/ui@master] Merge functionality of FloatingMenuSelectWidget into MenuSelectWidget

https://gerrit.wikimedia.org/r/350479

Change 348799 abandoned by Bartosz Dziewoński:
MenuSelectWidget: Workaround for scrolling to top of page for dropdowns with $overlay

Reason:
See https://gerrit.wikimedia.org/r/350479 for a proper solution.

https://gerrit.wikimedia.org/r/348799

Change 350479 merged by jenkins-bot:
[oojs/ui@master] [DEPRECATING CHANGE] Merge functionality of FloatingMenuSelectWidget into MenuSelectWidget

https://gerrit.wikimedia.org/r/350479

matmarex claimed this task.
matmarex edited projects, added OOUI (OOjs-UI-0.21.3); removed Patch-For-Review, OOUI.