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

Add keyboard mnemonics #106

Merged
merged 4 commits into from
May 27, 2020
Merged

Add keyboard mnemonics #106

merged 4 commits into from
May 27, 2020

Conversation

daguej
Copy link
Contributor

@daguej daguej commented May 22, 2020

This adds keyboard mnemonics to the default menu item labels.

image

Notice the underlined letters, which represent shortcut keys for each menu item. These accelerator keys match the ones Chrome uses in its context menu.

Windows hides the mnemonic underlines by default, but the shortcut keys still work. Users can see the underlines by holding Alt while right-clicking, or by configuring their system to always show underlines in Settings > Ease of Access > Keyboard.

Linux behavior varies.

This will have no effect on Mac, which does not support keyboard mnemonics in menus.


This also fixes a bug affecting all platforms: the mnemonic metacharacter (&) was not escaped when copying selected text into a label's {selection} placeholder, so any ampersands in the selected text disappeared from the menu (and potentially set an unwanted mnemonic).

@sindresorhus
Copy link
Owner

What about Save Image and Look Up?

@daguej
Copy link
Contributor Author

daguej commented May 26, 2020

I missed Save Image because I was comparing with the Chrome context menu, which does not have that option (only "save image as"). I'll make it m since it does not conflict with any Chrome items.

Since Look Up is only supported on Macs, there's no point in adding a mnemonic -- MacOS does not support or display them.

also noticed that the search item had a different mnemonic than in chrome
@sindresorhus sindresorhus merged commit dff7d88 into sindresorhus:master May 27, 2020
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.

None yet

2 participants