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 {}