-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Move MenuBar index check to an overridable method #733
Conversation
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
Let me know whether I can do anything to help resolve the errors in the CI |
@krassowski I pushed the linter fix as a separate commit. If you prefer squashed commits, I can also happily do that |
Separate commits work well, we can squash on merge. To fix I am not sure why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you @sdirix!
@krassowski Please wait with the merge. While this fix enables us to build our menus, I just realized that there are some usability edge cases remaining, e.g. the menus can be opened but do not react on hover. I had a quick glance at the code base: There are more places in which I'll come back to you. Sorry for the inconvenience! |
I will close the PR for now until we come up with a better solution . As described above, this PR is not sufficient to support empty menus properly and therefore neither improves the code base nor helps adopters like us. Instead some more changes are necessary . See for example here and here for more hard coded checks. For now we use a workaround: We always add at minimum one dummy element into all menus to bypass the Lumino checks. Once the (sub) menu is about to be shown, we replace the element with the real elements. This works as we don't have empty top level menus. Once we come up with a more elegant solution I'll come back to you. Thanks for your patience :) |
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 #729