Skip to content

Conversation

@microbit-matt-hillsdon
Copy link
Contributor

@microbit-matt-hillsdon microbit-matt-hillsdon commented Apr 9, 2025

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:

<script>
      Object.defineProperty(navigator, 'platform', {
        value: 'Windows',
      });
</script>

near the top of the HTML file (needs to be early). Any value that doesn't start Mac is good.

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.
@microbit-matt-hillsdon microbit-matt-hillsdon requested a review from a team as a code owner April 9, 2025 14:00
@microbit-matt-hillsdon microbit-matt-hillsdon requested review from rachel-fenichel and removed request for a team April 9, 2025 14:00
@microbit-matt-hillsdon
Copy link
Contributor Author

Back to draft for a mo to keep concise form on the context menu.

@microbit-matt-hillsdon microbit-matt-hillsdon marked this pull request as draft April 9, 2025 14:04
Copy link
Collaborator

@maribethb maribethb left a 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.

* @param format The key format.
* @returns The formatted shortcuts.
*/
export function actionShortcutsForPlatform(
Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Contributor Author

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).

@maribethb maribethb merged commit 053faf2 into RaspberryPiFoundation:main Apr 14, 2025
2 checks passed
@microbit-matt-hillsdon
Copy link
Contributor Author

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.

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:

Hello, in English the shortcut is Ctrl+Shift+Space which can't be kept in German as the German keyboard has a localized version of Ctrl (Strg), Shift (Umschalt) and Space ("Leertaste"). Can this shortcut be translated somehow?

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.

2 participants