Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Menu on Windows now properly responds to ALT #7485

Merged
merged 1 commit into from
Mar 10, 2017
Merged

Menu on Windows now properly responds to ALT #7485

merged 1 commit into from
Mar 10, 2017

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Mar 4, 2017

Test Plan:

Make sure "Hide menu bar by default" is set to true in Preferences > General

Alt codes (ensure behavior has not regressed)

  1. Launch Brave on Windows and visit duckduckgo.com
  2. Put cursor inside the search box
  3. Hold alt (left alt) and then use number pad to enter 227, then let go of alt
  4. Menu status should not have changed and there should be the Pi symbol (π) in the search box

AltGr (ensure behavior has not regressed)

  1. Press the right alt button (AltGr) and let go
  2. Menu status should not have changed

Multiple keys at the same time

  1. Press and hold shift and then also (with shift still pressed in) press left alt (this is commonly used to switch keyboard layout)
  2. Menu status should not have changed
  3. Press and hold shift, then press and hold left alt. Once left alt is pushed in, let go of shift and then let go of alt. You can try to do this slow or fast to simulate someone hitting shift + alt (but letting go of shift first)
  4. Menu status should not have changed

Happy path

  1. Press left alt (and only left alt) and then let go
  2. Menu should toggle 😄

Description

Menu on Windows now properly responds to ALT

Menu is now toggled only under these conditions:

  • the left ALT key is pressed (ignore AltGr)
  • last key pressed was ALT (typing ALT codes should not toggle menu)
  • no other key is being pushed simultaneously
  • since initial keydown, ALT has been the only key pressed

NOTE: key state is reset when window blurs (in case you used a shortcut that opened a new window, which prevents the keyup handler from firing on release)

Auditors: @jonathansampson, @bbondy

Fixes #5775

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Menu is now toggled only under these conditions:
- the left ALT key is pressed (ignore AltGr)
- last key pressed was ALT (typing ALT codes should not toggle menu)
- no other key is being pushed simultaneously
- since initial keydown, ALT has been the only key pressed

NOTE: key state is reset when window blurs (in case you used a shortcut that opened a new window, which prevents the keyup handler from firing on release)

Auditors: @jonathansampson, @bbondy

Fixes #5775
Copy link
Collaborator

@jonathansampson jonathansampson left a comment

Choose a reason for hiding this comment

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

Looks good. My numpad is wireless, and stopped working. But what I could test worked as expected, and the commit is pretty straight-forward.

@bsclifton bsclifton requested a review from srirambv March 8, 2017 21:31
@bsclifton
Copy link
Member Author

@srirambv would you be able to try this out too before we merge?

@srirambv
Copy link
Collaborator

srirambv commented Mar 8, 2017

  • Unable to test the Alt codes using onscreen keyboard. Clicking on Alt+2 in onscreen keyboard is recognized properly and puts the ASCII code in the search box but subsequent 2 is not recognized along with Alt and ends up adding 2 after the ASCII code.
  • AltGtr is working as expected
  • Multiple keys at the same time still needs testing

@bsclifton
Copy link
Member Author

quick update- @srirambv and I had tested in person after he plugged in an external keyboard which has the number pad

I also updated the text of the original post here to make it clear what functionality worked prior to this PR (meaning we are testing it for regression)

@bsclifton bsclifton removed the request for review from bbondy March 10, 2017 08:10
@bsclifton
Copy link
Member Author

Given the above, I'll go ahead and merge this one 😄

@bsclifton bsclifton merged commit 7e5af38 into brave:master Mar 10, 2017
@bsclifton bsclifton deleted the menu-alt-fix branch March 10, 2017 08:12
@bsclifton bsclifton added this to the 0.13.6 milestone Mar 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants