-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix #9779: add support for window.menuBarVisibility #9830
Fix #9779: add support for window.menuBarVisibility #9830
Conversation
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.
@ChayaLau thank you for the contribution 👍
Please ensure that:
- the breaking changes introduced in this pull-request are properly documented in the changelog - if we can avoid breakage please go that route.
- the default layout is broken when starting the application in the browser.
- please confirm the behavior when testing the changes in
electron
for the different settings.
d593b44
to
667abcd
Compare
hi, in addition i wanted to mention this setting in VS CODE - has one additional option to this - toggle which i still did not develop, and planning on adding it soon. will this be OK adding it in like this and adding the option in the future, or will it be merged only if we add the toggle now? Thanks, |
I'll take a closer look and identify any breaking changes. Ideally, if something is breaking for downstream applications and extensions we should aim to not break, and if its not possible we should add a note in the changelog about possible breakage like so:
We can always add the |
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.
@ChayaLau the main-menu is broken in the electron
target with these changes, please address the issue before we proceed with an in-depth review.
The following is with classic
(default), no main-menu exists:
Thanks @vince-fugnitto for this important point, i fixed the broken electron menu |
1ea3ec1
to
9581076
Compare
What is the intended behavior of the The menu has been removed from the top section, but the top section remains, so the user doesn't get back any vertical space by hiding the menu. In Electron, the bar disappears completely, but it also doesn't contain the branding icon that the browser does. |
I agree, the whole top-menu should be hidden else there is no value for end-users. |
} | ||
} | ||
} | ||
|
||
protected onClick(e: React.MouseEvent<HTMLElement, MouseEvent>, menuPath: MenuPath): void { |
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.
Minor, and related only to old code: this method uses the click as the anchor for the menu. In VSCode, the menu is always anchored to the right of the element, so it likely uses the element's coordinates instead.
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.
Reference for VSCode open menu code: https://github.com/microsoft/vscode/blob/99f71a032ea932670744d14d6364903a00b99ae3/src/vs/base/browser/ui/menu/menubar.ts#L957
Because of the way MacOS handles menu bars, this preference doesn't have any effect in Theia - the menu bar can be made compact, but it always appears in the OS menu bar anyway. The preference doesn't appear to be present in the MacOS version of VSCode, so perhaps we should also conditionally bind it so that it doesn't appear as a preference in Electron if we detect that we're running on MacOS. |
i saw this is the behavior in VS code, are we sure we want the whole line to disappear not like VS Code? |
If it's the intended behavior, then it is working as intended 👍. I would agree with @vince-fugnitto that that's somewhat odd behavior, since there doesn't then seem much point in hiding the menu, but I guess it reduces visual noise a bit. |
@colin-grant-work - I looked at this behavior, i think visible in VS Code refers only to the top menu, and not the sidebar. In order to refer to menuBarVisibility preference i tried to inject |
@colin-grant-work - i will add the |
Definitely - the sidebar is not visible here because I hid it, and that's fine. But the top bar should be visible.
That's a little surprising - I'm happy to take a look at this to see what's going on. PS: I originally clicked 'Edit' on your message rather than 'Quote Reply' by accident. Sorry if I restored the content wrong! |
@colin-grant-work - i added the injection and handled the maximized mode. |
b561c4d
to
53e9536
Compare
I'll take a more careful look tomorrow, but I'm still seeing some oddities with the The menu is still visible, but (in Electron) the maximized tab isn't truly maximized on the vertical axis, and the shell is still visible behind it. It appears to be working correctly in the browser, so I would guess that it has something to do with reserving space for the top panel, which doesn't exist in the Electron target. |
84e5eaa
to
aa33d1a
Compare
eeca14a
to
18c87d7
Compare
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.
I noticed an odd bug, but it might indicate issues with other menu items as well:
- set
menuBarVisibility
tocompact
- attempt to open the
preferences-view
through the menu
preferences-menu.mp4
I was only able to reproduce through compact
, the default menu worked fine for the same use-case.
Also, when no workspace is present and menuBarVisibility
is set to something other than classic
, the menu appears as default then is updated to the correct value. It might be something to look into but is not super critical.
menu-flicker.mp4
a0570d4
to
24dc613
Compare
@vince-fugnitto - thanks for the comments, i fixed accordingly. |
One way to handle this might be to delay the initial population of the top panel until after |
ca77ffb
to
d0892bc
Compare
@ChayaLau, you seem to have made a change to handle the flashing menu, but your change has had the consequence that now the menu is never shown if the user has not set the preference: It is not safe to rely on await this.preferenceService.ready
const myValue = this.preferenceService.get('my-preference'); And that should be done wherever the menu is constructed so that it can be created according to whatever values is found when the |
4547b21
to
e460297
Compare
@colin-grant-work - i tried to test before, and because i saw the preference change was firing - i thought that is enough. |
@ChayaLau, I also notice that you're doing checks for whether the application is running in Electron, but in fact a parallel problem occors in Electron. Here I've set the menu bar visibility to 'compact,' but the menu appears for a moment before disappearing when the preference change event fires. |
e460297
to
bd6c5e1
Compare
@colin-grant-work - thanks for this point, i fixed this by - first i hide the menu, then i run the |
Signed-off-by: ChayaLau <[email protected]>
bd6c5e1
to
465e7be
Compare
@colin-grant-work , @vince-fugnitto - is there any chance merging this into the next branch? |
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.
Though testing this in Electron is a little tricky at the moment, I retested this and found that
- Changing from all any preference selection to another works in both Electron and browser
- Maximizing a pane works with all preference settings in both Electron and browser
- Reloading the application doesn't produce any odd transitory behaviors in either Electron or browser
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.
The changes work well for me 👍
- changing the preference value works well for both the
browser
andelectron
targets - changing the visibility is quick and does not produce flickering
- reloading the application properly restores the menu state without flickering
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.
I can confirm the observations mentioned by Vince and Colin:
- Changing between different menu bar states works flawlessly
- Reloading the application produces no odd behavior
- Works both on electron and browser targets
Signed-off-by: ChayaLau <[email protected]>
Signed-off-by: ChayaLau <[email protected]>
Signed-off-by: Esther Perelman [email protected], Chaya Lau [email protected]
What it does
Fix #9779 add support for window.menuBarVisibility
The pull-request adds the menu Bar Visibility setting to window setting, this allows compact and hidden layout for menu bar.
How to test
click on settings -> preferences ->
tap menu bar visibility in the search
menu bar visibility section should be displayed and drop down should appear with the options :
classic - menu bar should be displayed on the top - as original.
visible - behaves like classic.
hidden - menu bar does not appear anywhere.
compact - Menu is displayed as a compact button in the sidebar.
Review checklist
Reminder for reviewers