Skip to content

Focus newly created function block after Make a Function#11375

Merged
riknoll merged 2 commits into
microsoft:masterfrom
microbit-matt-hillsdon:focus-new-functions
Jun 8, 2026
Merged

Focus newly created function block after Make a Function#11375
riknoll merged 2 commits into
microsoft:masterfrom
microbit-matt-hillsdon:focus-new-functions

Conversation

@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor

The Edit Function modal restores DOM focus to whatever was focused before it opened, so editing an existing function returns focus to that block. For Make a Function the trigger was a toolbox/menu element, leaving the new block unfocused. Explicitly focus the newly created definition block after the modal's focus-restore tick.

Note: I've opened a Blockly PR that fixes issue with navigating to the expand icon on collapsed blocks (including functions), see RaspberryPiFoundation/blockly#9958

The Edit Function modal restores DOM focus to whatever was focused before
it opened, so editing an existing function returns focus to that block.
For Make a Function the trigger was a toolbox/menu element, leaving the
new block unfocused. Explicitly focus the newly created definition block
after the modal's focus-restore tick.
@riknoll riknoll merged commit 816dfaf into microsoft:master Jun 8, 2026
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