Key-pressed blocks: key picker improvements
Feature request description
The key () pressed? block could be enhanced in multiple ways.
-
[ ] The dropdown menu is a long list, which can make it harder to select a key. Scratch uses unique menus for some blocks like
point in direction ()andplay note () for () seconds. Arranging these items in a real keyboard layout would allow for quicker access. -
[ ] It could be faster to type in the key you want to select instead of picking it from the menu.
editor-searchable-dropdownsalready lets you do this, but you still have to click or press Enter on the result. -
[x] Some keys that can be sensed (e.g., special characters) are not visible in the dropdown menu. The addon
editor-extra-keysalready adds these as options.
These three improvements would easily fit into one addon that improves the key-selection dropdown menu.
https://github.com/user-attachments/assets/7557e598-d10b-470e-95d0-93b8c4906e65
Related
- A similar UI could be used for the Gamepad addon (see #7292).
Arranging these items in a real keyboard layout would allow for quicker access.
This requires knowing the user's keyboard layout. Unfortunately, the API for that is currently only supported by Chromium: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/getLayoutMap
Arranging these items in a real keyboard layout would allow for quicker access.
This requires knowing the user's keyboard layout. Unfortunately, the API for that is currently only supported by Chromium: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/getLayoutMap
I didn't know about that API! So, we could adapt the displayed keyboard layout on Chrome and fall back to a default of QWERTY on other browsers.