Skip to content

Commit 563419a

Browse files
committed
fix: add comma to block labels except on Apple devices
1 parent 4a935bd commit 563419a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

packages/blockly/core/block_svg.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import {Rect} from './utils/rect.js';
6767
import {Svg} from './utils/svg.js';
6868
import * as svgMath from './utils/svg_math.js';
6969
import {FlyoutItemInfo} from './utils/toolbox.js';
70+
import * as userAgent from './utils/useragent.js';
7071
import type {Workspace} from './workspace.js';
7172
import type {WorkspaceSvg} from './workspace_svg.js';
7273

@@ -2020,11 +2021,13 @@ export class BlockSvg
20202021
fullBlockField.recomputeAriaContext();
20212022
return;
20222023
}
2023-
aria.setState(
2024-
this.getFocusableElement(),
2025-
aria.State.LABEL,
2026-
this.getAriaLabel(aria.Verbosity.STANDARD),
2027-
);
2024+
let label = this.getAriaLabel(aria.Verbosity.STANDARD);
2025+
// VoiceOver inserts a comma between aria-label and aria-roledescription.
2026+
// Specific screen readers are not detectable, so OS is used as a proxy.
2027+
if (label && !userAgent.APPLE && !label.endsWith(',')) {
2028+
label += ',';
2029+
}
2030+
aria.setState(this.getFocusableElement(), aria.State.LABEL, label);
20282031
configureAriaRole(this);
20292032
}
20302033

0 commit comments

Comments
 (0)