Skip to content

Fix menubar toggle alt key detection on focus - #12167

Merged
zcbenz merged 1 commit into
electron:masterfrom
lyallh:menubar-autohide-fix
Mar 9, 2018
Merged

zcbenz merged 1 commit into
electron:masterfrom
lyallh:menubar-autohide-fix

Conversation

@lyallh

@lyallh lyallh commented Mar 8, 2018

Copy link
Copy Markdown
Contributor

Reset alt keypress flag on window blur so switching window via
Alt+* desktop / window manager keybindings can't incedentally trigger
annoying menubar toggles.

This issue is a recurring complaint among some Atom and Vscode editor users. Especially in Vscode where you can't remap the Alt key.
(microsoft/vscode#35010, microsoft/vscode#41070, atom/atom#6037)

A description of the problem was given in PR #3218 but no fix made.

@lyallh
lyallh requested a review from a team March 8, 2018 07:17
@welcome

welcome Bot commented Mar 8, 2018

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

typing cat

Here is a list of things that will help get it across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.
    We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@lyallh

lyallh commented Mar 8, 2018 •

Copy link
Copy Markdown
Contributor Author

Needs review as I'm not exactly sure what the conditions are under OnWidgetActivationStateChanged. Guessing just focus/blur change.

Reset alt keypress flag on window blur so switching window via
Alt+* window manager keybindings can't incedentally trigger
annoying menubar toggles
@lyallh
lyallh force-pushed the menubar-autohide-fix branch from cc27ec6 to ba24920 Compare March 8, 2018 08:50

@codebytere codebytere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thanks!

@codebytere

Copy link
Copy Markdown
Member

i'll leave this up for more review though from someone who would better know conditions leading to OnWidgetActivationStateChanged

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this change, I'm not entirely sure whether it would have side effects, but it looks fine.

@zcbenz
zcbenz merged commit 44c66fc into electron:master Mar 9, 2018
@welcome

welcome Bot commented Mar 9, 2018

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@lyallh

lyallh commented Mar 9, 2018

Copy link
Copy Markdown
Contributor Author

Thanks @codebytere and @zcbenz

Flag seems to be used only for menu toggling and that now works as intended so should be fine.

@alexeykuzmin

Copy link
Copy Markdown
Contributor

Should we backport it to the 2-0-x to get feedback sooner?

@MarshallOfSound

Copy link
Copy Markdown
Member

#trop run backport

@trop-devel

trop-devel Bot commented Mar 13, 2018

Copy link
Copy Markdown

The backport process for this PR has been manually initiated, here we go :D

@trop-devel

trop-devel Bot commented Mar 13, 2018

Copy link
Copy Markdown

An error occurred while attempting to backport this PR to "2-0-x", you will need to perform this backport manually

@MarshallOfSound

Copy link
Copy Markdown
Member

#trop run backport

@trop-devel

trop-devel Bot commented Mar 13, 2018

Copy link
Copy Markdown

The backport process for this PR has been manually initiated, here we go :D

@trop-devel

trop-devel Bot commented Mar 13, 2018

Copy link
Copy Markdown

We have automatically backported this PR to "2-0-x", please check out #12235

leo-3889 added a commit to leo-3889/finevibe that referenced this pull request Oct 22, 2026
The visible menu bar latches on the Alt half of Alt+Tab (the alt-press
flag is not reset on window blur), and the native menu bar then consumes
the next Escape as "deactivate menu bar". The renderer never receives
the event, so xterm/PTY loses Escape after refocus while every other
key flows through (electron/electron#12167, #2504; same class as
microsoft/vscode#35010). autoHideMenuBar keeps the menu available on
Alt and off the Escape path.
leo-3889 added a commit to leo-3889/finevibe that referenced this pull request Oct 22, 2026
The visible menu bar latches on the Alt half of Alt+Tab (the alt-press
flag is not reset on window blur), and the native menu bar then consumes
the next Escape as "deactivate menu bar". The renderer never receives
the event, so xterm/PTY loses Escape after refocus while every other
key flows through (electron/electron#12167, #2504; same class as
microsoft/vscode#35010). autoHideMenuBar keeps the menu available on
Alt and off the Escape path.
leo-3889 added a commit to leo-3889/finevibe that referenced this pull request Oct 23, 2026
The visible menu bar latches on the Alt half of Alt+Tab (the alt-press
flag is not reset on window blur), and the native menu bar then consumes
the next Escape as "deactivate menu bar". The renderer never receives
the event, so xterm/PTY loses Escape after refocus while every other
key flows through (electron/electron#12167, #2504; same class as
microsoft/vscode#35010). autoHideMenuBar keeps the menu available on
Alt and off the Escape path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants