feat: Comments ARIA#9832
Merged
mikeharv merged 3 commits intoRaspberryPiFoundation:v13from May 8, 2026
Merged
Conversation
gonfunko
approved these changes
May 7, 2026
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.
The basics
The details
Resolves
Fixes #9663
Proposed Changes
This updates ARIA roles and labels for
CommentEditor,CommentView, andCommentBarButton(and its subclasses). It introduces parent tracking forCommentEditorand standardizes ARIA roles and labeling across comment views and top bar buttons.CommentEditor
role="textbox"to thetextareasetParent(newParent: BlockSvg | RenderedWorkspaceComment)getParent(): BlockSvg | RenderedWorkspaceComment | undefinedRenderedWorkspaceCommentfor workspace comments or byCommentIconfor block comments.CommentView
role="button"since enter activates editing.aria-roledescription="Comment"(localized) so that the user gets more than just 'button' context when interacting with the view.aria-labelledby, referencing the editor text area ID.CommentBarButton (and subclasses)
recomputeAriaContext()to initialize/update ARIA role and label after icon creation.getAriaLabel(): string | nullfor subclasses to provide contextual labels.recomputeAriaContext()after icon initializationrole="button"on the icon.aria-labelusing subclass-provided label or a localized default ("Button").CollapseCommentBarButton: dynamically provides "Collapse Comment" / "Expand Comment" based on state.DeleteCommentBarButton: provides "Remove Comment".Reason for Changes
These changes improve accessibility across comments correct semantic roles and labels for assistive technologies.
Test Coverage
Added unit tests covering:
CommentEditor:role="textbox"CommentView:role="button"aria-roledescriptionis set to "Comment"aria-labelledbycorrectly references the editor textarea IDCommentBarButton:role="button"getAriaLabelCollapseCommentBarButtonupdates ARIA label dynamically when toggledDeleteCommentBarButtonuses correct static label