From bb6875c5d04a6f23a59a8c107906a41f50db024d Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 7 May 2026 14:14:04 -0700 Subject: [PATCH] fix: Update workspace ARIA label on focus --- packages/blockly/core/workspace_svg.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/blockly/core/workspace_svg.ts b/packages/blockly/core/workspace_svg.ts index 0c0854f5023..c886219d40c 100644 --- a/packages/blockly/core/workspace_svg.ts +++ b/packages/blockly/core/workspace_svg.ts @@ -720,7 +720,7 @@ export class WorkspaceSvg ); } else { // Main workspaces get labelled with how many stacks of blocks they contain - // This will be updated in a change listener, but set it here in case there are blocks in the initial state of the workspace + // This will be updated on focus, but set it here in case there are blocks in the initial state of the workspace this.updateAriaLabel(); } } @@ -798,14 +798,6 @@ export class WorkspaceSvg this.setInitialAriaContext(); - if (!this.isFlyout && !this.isMutator) { - // Set up a change listener to update the aria label on main workspace - this.addChangeListener((e) => { - if (e.isUiEvent) return; - this.updateAriaLabel(); - }); - } - if (!this.isFlyout) { browserEvents.conditionalBind( this.svgGroup_, @@ -2696,7 +2688,11 @@ export class WorkspaceSvg } /** See IFocusableNode.onNodeFocus. */ - onNodeFocus(): void {} + onNodeFocus(): void { + if (!this.isFlyout && !this.isMutator) { + this.updateAriaLabel(); + } + } /** See IFocusableNode.onNodeBlur. */ onNodeBlur(): void {}