Skip to content

Expose text-editing accessibility semantics on the editor - #30

Merged
Wavesonics merged 1 commit into
mainfrom
add-text-field-semantics
Jun 30, 2026
Merged

Expose text-editing accessibility semantics on the editor#30
Wavesonics merged 1 commit into
mainfrom
add-text-field-semantics

Conversation

@Wavesonics

Copy link
Copy Markdown
Collaborator

What

Adds a Modifier.semantics { } block to the editable Box in BasicTextEditor, exposing text-editing semantics wired to the existing TextEditorState:

  • editableText, textSelectionRange (read)
  • setText, insertTextAtCursor, setSelection (edit actions)
  • onClick { requestFocus }

Why

The editor was focusable() and integrated with the platform IME via PlatformTextInputModifierNode, but published no text-editing semantics. Consequences:

  1. Accessibility gap: VoiceOver / TalkBack couldn't recognize it as an editable text field — content wasn't readable or editable by screen readers.
  2. iOS UI automation: Because no node advertised editable-text semantics, Compose's iOS accessibility bridge never exposed the focused editor as a keyboard-focused text element, so XCUITest couldn't type into it (app.typeText fails its "is any element keyboard-focused?" pre-check). Standard BasicTextFields work precisely because they publish these semantics.

Validation

Verified end to end: published a snapshot to mavenLocal, pointed a downstream Compose Multiplatform app (hammer-editor) at it, and confirmed an XCUITest that creates a note by typing into the editor body now passes on the iOS simulator — previously blocked at the keyboard-focus check.

Behavior for existing consumers is unchanged; the semantics are additive.

🤖 Generated with Claude Code

The editable Box was focusable and wired to the platform IME, but published
no text-editing semantics. As a result accessibility services (VoiceOver /
TalkBack) couldn't read or edit its content, and on iOS the platform never
exposed the focused editor as a keyboard-focused text element — so UI-test
frameworks like XCUITest couldn't type into it (no element reports
`hasKeyboardFocus`).

Add a `Modifier.semantics` block, wired to the existing TextEditorState API,
exposing `editableText`, `textSelectionRange`, `setText`, `insertTextAtCursor`,
`setSelection`, and `onClick` (request focus). This makes the node a
first-class editable text field for accessibility, and lets XCUITest drive
text entry (verified end to end against a downstream app on the iOS simulator).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Wavesonics
Wavesonics merged commit 734ea71 into main Jun 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant