Skip to content

Commit 8b698cf

Browse files
authored
fix(tldraw): expose UI to mobile screen readers via role=document (tldraw#8901)
In order to make the tldraw UI reachable to mobile screen readers, this PR marks the `tlui-layout` wrapper with `role="document"`. The outer `tl-container` has `role="application"`, which VoiceOver (iOS) and TalkBack (Android) do not announce at all, leaving the toolbar, menus, and dialogs effectively invisible to mobile assistive tech. Per the [MDN guidance](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/application_role#description), interspersing `role="document"` inside an `application` region restores normal document semantics for non-application UI while leaving the application's keyboard-interaction model on the outer container untouched. Closes tldraw#8849. ### Change type - [x] `bugfix` ### Test plan 1. Open the examples app with VoiceOver enabled on iOS Safari and confirm the toolbar, page menu, and dialogs are announced and navigable. 2. Repeat on Android Chrome with TalkBack. 3. With a desktop screen reader (NVDA or macOS VoiceOver), confirm the canvas is still announced as an application and shapes are still keyboard-interactive. - [ ] Unit tests - [ ] End to end tests ### Release notes - Mark the tldraw UI layer with `role="document"` so toolbars, menus, and dialogs stay reachable to mobile screen readers like VoiceOver and TalkBack, which do not announce the outer canvas `role="application"`. ### Code changes | Section | LOC change | | ------------- | ---------- | | Core code | +6 / -0 | | Documentation | +1 / -0 |
1 parent b9e8265 commit 8b698cf

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

apps/docs/content/releases/next.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ The page menu no longer has an explicit edit mode. Reorder pages by dragging a r
2525
- Fix a misleading "license expired" console warning for perpetual licenses on covered versions. ([#8791](https://github.com/tldraw/tldraw/pull/8791))
2626
- Fix inconsistent tooltip behavior on the video toolbar by using `TldrawUiToolbarButton` for the replace and download buttons. ([#8794](https://github.com/tldraw/tldraw/pull/8794))
2727
- Fix the missing open-state hint on the page menu and zoom menu triggers when rendered outside the main toolbar. ([#8813](https://github.com/tldraw/tldraw/pull/8813))
28+
- Mark the tldraw UI layer with `role="document"` so toolbars, menus, and dialogs stay reachable to mobile screen readers like VoiceOver and TalkBack, which do not announce the outer canvas `role="application"`. ([#8849](https://github.com/tldraw/tldraw/issues/8849))

packages/tldraw/src/lib/ui/TldrawUi.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ const TldrawUiContent = React.memo(function TldrawUI() {
184184
className={classNames('tlui-layout', {
185185
'tlui-layout__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
186186
})}
187+
// The outer editor container has role="application" so that desktop screen readers treat
188+
// the canvas as an interactive surface. Mark the UI layer as role="document" so that the
189+
// toolbar, menus, and dialogs stay navigable to assistive tech — especially mobile screen
190+
// readers like VoiceOver and TalkBack that do not announce role="application". See
191+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/application_role
192+
role="document"
187193
// When the virtual keyboard is opening we want it to hide immediately.
188194
// But when the virtual keyboard is closing we want to wait a bit before showing it again.
189195
data-iseditinganything={hideToolbarWhileEditing}

0 commit comments

Comments
 (0)