Skip to content

fix: drop IFocusableNode from trash and zoom - #10272

Open
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:unfocus
Open

fix: drop IFocusableNode from trash and zoom#10272
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:unfocus

Conversation

@mikeharv

@mikeharv mikeharv commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #9792

Proposed Changes

  1. Trashcan and zoom controls are no longer IFocusableNodes. They stay ordinary tabindex="0" buttons.
  2. FocusableTreeTraverser.findFocusableNodeFor no longer walks from an unregistered tab stop (tabindex >= 0) up to an ancestor node. FocusManager therefore does not steal DOM focus from those controls back to the workspace.
  3. New bindings for Enter/Space on trash and zoom controls.
  4. Focus rings use :focus-visible instead of blocklyActiveFocus.
  5. The trash now follows the blocks canvas in the DOM, which aligns with expectations around tab order.
  6. Trash opacity is only applied to the sprite and lid (and not the focus ring)

Reason for Changes

Trash and zoom lived inside the workspace's focusable DOM (svgGroup_) and were also extra tab stops. That made them feel like both separate tab stops and part of the workspace. Tab skipped the workspace if a workspace control had previously been focused, and arrow keys jumped focus from the controls onto blocks.

Dropping IFocusableNode alone is not enough, because the traverser still mapped those elements to the workspace. This would make focusing the elements impossible. Skipping tab stops when traversing parents lets the trash and zoom buttons keep native focus without being Blockly focus nodes.

Test Coverage

  • Traverser tests check for expected results with tabindex values of 0 and -1
  • Trash and zoom tests assert they are tab stops and are not claimed as workspace focus nodes.

Additional Information

An alternative was considered where the trash and zoom controls remained focusable node but became their own trees. That work was explored here:

@github-actions github-actions Bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Aug 14, 2026
@mikeharv
mikeharv marked this pull request as ready for review August 14, 2026 19:29
@mikeharv
mikeharv requested a review from a team as a code owner August 14, 2026 19:29
@mikeharv
mikeharv requested a review from lizschwab August 14, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v13.0.0-beta.2] Trashcan focus and focus outlines

2 participants