jupyterlab / lumino

Lumino is a library for building interactive web applications
https://lumino.readthedocs.io/
Other
598 stars 127 forks source link

`Menu.open()` should have an option to align `x` and `y` to the top right of the menu. #709

Open andrewfulton9 opened 2 weeks ago

andrewfulton9 commented 2 weeks ago

Problem

I am trying to add a button to an extension that opens a menu. The button is on the far right side of the window, so the menu is automatically shifting to fit into the window. If I use the forceX option a portion of the menu will be out of the window and not viewable.

See the thread here for more context.

Proposed Solution

I propose adding a parameter to Menu.IOpenOptions to specify how the menu would relate to x and y. It could be something like align with the possible options "right" and "left". "left" would be default and it would align the top-left of the menu to x and y. "right" would align the top-right of the menu to x and y.

fcollonval commented 1 week ago

Thanks for the suggestion @andrewfulton9

Minor comment on the proposed solution: although accessibility concepts are not well integrated in existing Lumino code. For new proposals like this one, we should consider it more thoughtfully. Therefore, I would suggest having a default matching the language direction rather than left if possible.