-
Notifications
You must be signed in to change notification settings - Fork 13
Share shortcut formatting between help/menu/messages #408
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
Share shortcut formatting between help/menu/messages #408
Conversation
Update "toast" message on enter to reference help which we think is a better option based on user testing. Partly motivated by wanting to rebind list_shortcuts in MakeCode and have the correct shortcut be shown by the toast/dialog.
|
Back to draft for a mo to keep concise form on the context menu. |
maribethb
left a comment
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.
Something to think about (no action needed for this PR) is how localizable this is. Getting the actual key out of the registry is a good first step, but I'm curious if anything will need to change e.g. for "ctrl" in other keyboard layouts? I don't know how non-US keyboards handle this kind of thing.
For the basic label I've filed #412 because all of the bare strings will need to be moved into Blockly.Msg. As long as all languages are cool with the order of "name of shortcut" followed by "keypresses" then it should be fine to just concatenate the two values we got out of Blockly.Msg. But if some languages would have them in different order then we'll need to research and design around that in the future.
src/shortcut_formatting.ts
Outdated
| * @param format The key format. | ||
| * @returns The formatted shortcuts. | ||
| */ | ||
| export function actionShortcutsForPlatform( |
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.
generally I'd prefer having a getShortActionShortcut and getLongActionShortcut instead of making the user pass a magic string, if there's only two options.
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.
or potentially having one method with a boolean to switch to short mode or something like that
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.
Slightly complicated by there being short vs long but also individual keys vs joined string. Gone with API that looks nice for the callers in 6f692d4 as in fact we only use short + joined string (for context menu) and long + individual keys (for help dialog).
Coincidentally I just read a translation-related issue in the micro:bit Python Editor where someone requests localization for "Ctrl+Shift+Space", so this is a thing some folks want in a related context:
|
Update "toast" message on enter to reference help which we think is a better option based on user testing.
Partly motivated by wanting to rebind list_shortcuts in MakeCode and have the correct shortcut be shown by the toast/dialog.
This also consistently avoids using + between shortcuts on Mac.
To test on Windows on Mac you can do:
near the top of the HTML file (needs to be early). Any value that doesn't start Mac is good.