fix(diffs): Add accessible name to editor textbox host - #829
Merged
Conversation
The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mdo
approved these changes
Jun 17, 2026
mdo
left a comment
Contributor
There was a problem hiding this comment.
Confirmed locally, label is present.
amadeus
pushed a commit
that referenced
this pull request
Jun 22, 2026
The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
amadeus
pushed a commit
that referenced
this pull request
Jun 24, 2026
The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
amadeus
pushed a commit
that referenced
this pull request
Jun 24, 2026
The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
tjni
pushed a commit
to tjni/pierre
that referenced
this pull request
Jun 25, 2026
…r#829) The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
amadeus
pushed a commit
that referenced
this pull request
Jul 21, 2026
The contenteditable host advertises role="textbox" but had no accessible name, so screen readers announced an unlabeled text field. Label it with the current file name in __syncRenderView. The content element is reused across file switches, so the label is refreshed on every sync rather than only when the element is first initialized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The editor's
contenteditablehost inpackages/diffs/src/editor/editor.tssetsrole="textbox"andaria-multiline="true"but never sets an accessible name. Screen readers announce it as an unlabeled text field, so users have no way to tell which file the editing surface belongs to.Change
Set
aria-labelto the current file name in__syncRenderView.The label is set outside the block that initializes the content element's static attributes. That block only runs when the content element node changes, but
File#applyFullRenderreuses the same content element node across file switches (it replaces the inner HTML rather than the element). Setting the label only on initialization would leave it pointing at the previous file after a switch, so the label is refreshed on every sync, guarded by a value check to avoid redundant DOM writes on the render path.A
tabindexwas considered but not added: acontenteditable="true"element is already focusable with an implicittabindex=0, and adding one could change focus behavior.The fix lives in the editor's shared
__syncRenderView, which bothFileandFileDiffroute through, so file and diff views are both covered.Verification
moonx diffs:typecheckmoonx diffs:test(551 pass)moon run root:format root:lint(no new warnings)