Skip to content
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

Reimplement window.menuBarVisibility preference #10643

Closed
wants to merge 1 commit into from

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Jan 17, 2022

What it does

I'm leaving this in 'Draft' status while I do some more general testing...

Fixes #10571 by ensuring that the same logic is used for the main menu when window.menuBarVisibility is compact as when it is not.

The heart of this PR is a move to use the same menu widget for the (browser-style) main menu regardless of the value of the window.menuBarVisibility preference, rather than using a context menu in compact mode. That ensures that we get the same behavior as we do with the normal menu bar, and that any fixes apply equally to both. In particular, it ensures that (1) commands invoked from the main menu do not receive an anchor argument and (2) the logic for preserving the focus context to use when a command is run is consistent between the menu bar and compact menu.

While working on that, I noticed several other features of the menu implementation that could be improved:

  • the window.menuBarVisibility preference handling was scattered across a number of different classes. This PR moves (almost) all references to the preference into the MainMenuContribution classes.
  • event handling for menus was also split between the MainMenuFactory and MainMenuContribution classes. This PR moves all event handling into the MainMenuContribution classes, with the factories only responsible for creating the widget.

How to test

#10571
  1. Set the window.menuBarVisibility preference to 'compact' (non-OSX only)
  2. Open an editor
  3. Select some text
  4. Open the main menu > Edit > Cut
  5. The text you selected should be removed and available in your clipboard.
General
  1. In browser, test various transitions between and startup in different window.menuBarVisibility states.
  2. In Electron, test various combinations of window.titleBarStyle and window.menuBarVisibility states and transitions.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work added the menus issues related to the menu label Jan 17, 2022
@colin-grant-work colin-grant-work force-pushed the bugfix/improve-menu-handling branch 7 times, most recently from f7b6756 to c1391a0 Compare January 18, 2022 15:12
  - Uses same menu widget for compact and visible settings
  - Cleans up event handling in browser and Electron
      MainMenuContributions and MainMenuFactories
@colin-grant-work
Copy link
Contributor Author

Closing for now - seems better just to implement a focus restoration for the compact menu widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menus issues related to the menu
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'CUT' not work in context menu
1 participant