-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow empty menus to activate in menu bar #729
Comments
CC @gabalafou as author of #607. |
Thanks @sdirix for opening the issue! Cool to see Theia updating to Lumino! Agree it would be much better if Theia could just use the Lumino packages without having to maintain a patch 👍
Looking at the PR there does not seem to be any discussion about that check. But maybe @gabalafou or @fcollonval (reviewer) will know more.
This is indeed an approach that has been taken before to allow for easier subclassing. Maybe one downside to this would be the
Maybe this could be the less disruptive one, while allowing for easier customization downstream? If you would you like to start exploring this in a draft PR, that would be great, thanks! |
I second @jtpio. A good way would be to create a protected |
Thanks for the feedback 👍 . Sounds good, I will open such a PR |
Added a protected isValidIndex method to the MenuBar class to handle index validation before setting an index. This enables adopters to customize the validation logic, e.g., for supporting dynamic menus that may initially be empty. Resolves jupyterlab#729
Hi! I'm working on migrating to Lumino in Theia. We’ve previously relied on PhosphorJS, and decided to transition to Lumino.
Problem
We implemented a DynamicMenuWidget whose core functionality involves dynamically calculating its menu items just before being shown. This worked in PhosphorJS
However, we’ve encountered an issue with Lumino due to a change introduced in #607. Specifically, this check in the MenuBar prevents our menus from activating:
As a result, Theia’s dynamic menus are never activated and therefore never displayed.
Workarounds
We’ve explored a few workarounds:
patch-package
to remove the check, but this requires maintenance with every new Lumino release.activeIndex
setter to bypass the check, but this requires duplicating the setter code and working around type checks on private fields.Both approaches feel brittle and suboptimal for long-term maintenance.
Proposed Solution?
Would you be open to changes that make the
MenuBar
more flexible for downstream adopters like us? If so, we’d appreciate your input on the best way forward. Some potential approaches:MenuBar
to allow subclassing without type workarounds.Alternatively, if you have suggestions for a better way to implement dynamic menus in Theia that align more closely with Lumino's current design, I’d be very interested to hear your thoughts.
Thanks for all your work on Lumino—it’s a fantastic library, and we look forward to using it in Theia!
The text was updated successfully, but these errors were encountered: