Page MenuHomePhabricator

Automatically change popup direction if there is no space
Closed, ResolvedPublic

Description

Unless configured otherwise, popups should change direction if there is no space in their preferred direction (i.e. the popup hits the edge of the viewport/container and gets clipped to a very small size).

See also T114612: Add gravity option to OO.ui.PopupWidget

Related Objects

Event Timeline

matmarex subscribed.

This should be done not only for PopupWidget, but also for other dropdowny/popuppy things, e.g. DropdownWidget. (See comments on T107036)

So the re-orientation on normal <select> menus does work on a boundary. It's not automatically happening with only more size available above or below.

Change 385309 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[oojs/ui@master] [WIP] MenuSelectWidget, PopupWidget: Automatically change popup direction if there is no space

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

Change 385309 merged by jenkins-bot:
[oojs/ui@master] MenuSelectWidget, PopupWidget: Automatically change popup direction if there is no space

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

Although not main focus of this ticket, having adaptable popup direction solved T160001 . I have rechecked after OOjs UI got updated and popup is indeed displayed above the highlight button when there is no room to display the popup below the button.
Here is how it looked on OOjs UI v0.24.2 and how it works on OOjs UI v0.24.3 with highlights popup on RC filters:

OOjs UI v0.24.2OOjs UI v0.24.3
cut-off-OOjs-UI-v0.24.2.png (121×663 px, 7 KB)
popup-direction-OOjs-UI-v0.24.2.gif (197×724 px, 273 KB)

Is this expected?

The main reason I'm writing on this ticket is to get confirmation if following behavior is expected; When button itself is clipped, the popup does not adjust pop up direction to be above the button, but is rather displayed below the button and clipped alongside.

popup-direction-OOjs-UI-v0.24.2-hidden.gif (197×724 px, 259 KB)

That's a bug, I'll file another task and look into it.

T182650