Add support to open the main menus to the left
steff456 opened this issue ยท 3 comments
Problem
Hi! Doing the audits for zoom in JupyterLab we encountered that the menus are rendered always to the right and in small screens or high zoom the menus start to get chopped,
Proposed Solution
We thought that the best way to address this issue is to open the menus to the direction where there's more space in the screen.
Additional context
I want to make the contribution to fix this issue, and I've been playing around with the Menus however I have a couple of questions,
- There's an interface defined under
Menu.IOpenOptions
with two valuesforceX
andforceY
. I don't understand the difference of them when they are activated or deactivated, when changing the value in one of the examples, the behavior is exactly the same:
forceX: true, forceY: true
forceX: false, forceY: false
- I believe that I will have to implement the logic to open the menu to the other side, should I add this option to the
Menu.IOpenOptions
interface so developers can decide the direction they prefer? Or should we leave the menus to open by default to where there is more space in the interface?
Hope you can guide me to add this feature to Lumino ๐ฉ๐ปโ๐ป
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! ๐ค
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! ๐
Welcome to the Jupyter community! ๐
@steff456 the test you did is using the context menu not the menu bar. I think this is the reason you are not seeing any difference.
The forceN = false
parameter allows to ignore the computed default position to allow for the repositioning you are looking for. The change should be done in the MainMenu
class in JupyterLab: https://github.com/jupyterlab/jupyterlab/blob/fbfc6da7d3fd3636f179b79f1ac924050db17334/packages/mainmenu/src/mainmenu.ts#L27
It will be interesting to discuss this as there is probably a reason why the position are enforced.
Thanks for the reply!
I opened a PR, so just let me know there if you have any insight on why the x position is enforced and any comment for improvement is welcome as well :)