Skip to content

feat: Added keyboard shortcut for displaying tooltip - #9755

Merged
lizschwab merged 2 commits into
RaspberryPiFoundation:v13from
lizschwab:rpf-447
Apr 24, 2026
Merged

lizschwab merged 2 commits into
RaspberryPiFoundation:v13from
lizschwab:rpf-447

Conversation

@lizschwab

@lizschwab lizschwab commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes RaspberryPiFoundation/blockly-keyboard-experimentation#447

Proposed Changes

Adds a keyboard shortcut for displaying the tooltip.

Reason for Changes

Adding the ability to display the tooltip from a keyboard shortcut increases accessibility for keyboard users.

Test Coverage

Added unit tests around basic functionality, ensuring an existing tooltip does not block a new tooltip from popping up, and ensuring it does not display while dragging is happening.

Additional Information

Screenshots:
Screenshot 2026-04-24 at 1 48 43 PM
Screenshot 2026-04-24 at 1 48 07 PM

[ ] TODO: Update the key mapping to something that makes sense.
The key mapping in this PR is a placeholder; which actual key(s) to use is something that still needs to be decided. I picked Ctrl+J as it wasn't currently in use. I saw that VS Code uses Ctrl+K followed by Ctrl+I but I didn't see an obvious way to register this in the code and didn't want to spend extra time on it before we even know if we need to do so.

@lizschwab
lizschwab requested a review from a team as a code owner April 23, 2026 23:31
@lizschwab
lizschwab requested a review from gonfunko April 23, 2026 23:31
@github-actions github-actions Bot added the PR: feature Adds a feature label Apr 23, 2026
Comment thread packages/blockly/core/tooltip.ts Outdated
/**
* Display the tooltip for a given target.
*/
export function display(target: AnyDuringMigration, workspace?: WorkspaceSvg) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The show() function is relying on some checks already having been made, so I added this new function rather than exporting that one.

Comment thread packages/blockly/core/tooltip.ts Outdated
/**
* Display the tooltip for a given target.
*/
export function display(target: AnyDuringMigration, workspace?: WorkspaceSvg) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe make this @internal and use IFocusableNode as the type for target? If we're not expecting third party callers to use this it's probably better to keep it locked down for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be nice to add @param lines to the docstring too.

assert.deepEqual(oldBounds, newBounds);
});
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Throughout, assert.isTrue()/assert.isFalse() might make the intent a bit clearer.

Comment thread packages/blockly/core/tooltip.ts
@lizschwab
lizschwab requested a review from gonfunko April 24, 2026 21:11
@github-actions github-actions Bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Apr 24, 2026
@lizschwab
lizschwab merged commit 6d2a62c into RaspberryPiFoundation:v13 Apr 24, 2026
7 checks passed
@microbit-robert

Copy link
Copy Markdown
Collaborator

Regarding the shortcut, cmd J while using VoiceOver on mac works to open the tooltip, but it also triggers VoiceOver to output "jump to selection". Incidental, but when I was trying this out, I immediately tried cmd J to toggle the tooltip closed again, but you need Escape. No strong view either way.

@lizschwab

Copy link
Copy Markdown
Contributor Author

@microbit-robert Thanks for bringing that to our attention. This is a placeholder until we can find a better solution. I did not run into this issue myself when testing with VO, but we'll be replacing the shortcut with something else once it's been further discussed anyway so I'm not too concerned. Let us know if you have input on that; we've discussed Ctrl/Cmd + K, Ctrl/Cmd + I, but that is more complex than we'd like, Ctrl/Cmd + Q, but that is the quit application shortcut in Mac, and Ctrl/Cmd + F1, but we've been avoiding function keys up to this point. Happy to hear any suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants