feat(a11y): Implement AccessKit accessibility support for all UI components#2407
Open
huacnlee wants to merge 2 commits into
Open
feat(a11y): Implement AccessKit accessibility support for all UI components#2407huacnlee wants to merge 2 commits into
huacnlee wants to merge 2 commits into
Conversation
…onents Adds ARIA roles and accessibility attributes to all major components, leveraging the AccessKit integration shipped in the latest GPUI update. Each component now exposes semantic role, state, and label information to assistive technologies (VoiceOver, NVDA, AT-SPI). Component coverage: - Button: Role::Button / Role::Link, aria_label, aria_selected - Toggle / ToggleGroup: Role::Button + aria_toggled, Role::Toolbar - Checkbox: Role::CheckBox + aria_toggled + aria_label - Radio / RadioGroup: Role::RadioButton + aria_selected + position/size_of_set, Role::RadioGroup - Input: Role::TextInput / Role::MultilineTextInput - NumberInput: Role::SpinButton + aria_numeric_value - Slider: Role::Slider + aria_numeric_value + min/max + Increment/Decrement actions - Tab / TabBar: Role::Tab + aria_selected, Role::TabList - PopupMenu / AppMenuBar: Role::Menu, Role::MenuBar - MenuItem: Role::MenuItem + aria_selected - Dialog: Role::Dialog (configurable); AlertDialog: Role::AlertDialog - Alert: Role::Alert - Progress: Role::ProgressIndicator + aria_numeric_value + min/max - List / ListItem: Role::List + Role::ListItem + position/size_of_set + aria_selected - Table / TableHeader / TableBody / TableRow / TableHead / TableCell: Role::Table, Role::RowGroup, Role::Row + aria_row_index, Role::ColumnHeader / Role::Cell + aria_column_index - Accordion: Role::Group; AccordionItem header: Role::Button + aria_expanded - GroupBox: Role::Group - Combobox: Role::ComboBox + aria_expanded - DropdownButton: Role::Group - Stepper / StepperItem: Role::Group, Role::ListItem + aria_position_in_set - BreadcrumbItem: Role::Link / Role::ListItem - FormField: Role::Group - Root: Role::Application (window-level application landmark) Also adds: - SliderState::min_value() / max_value() / step_value() accessors - Dialog::a11y_role field for role override - Radio::position_in_set / size_of_set fields populated by RadioGroup - script/run-story-macos: launch Story as a signed macOS .app bundle for VoiceOver testing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Great thx for your work! like: Button::new("close")
.icon(IconName::X)
.aria_label("Close") |
Member
Author
|
Still not working, I don't know the reason. macOS Accessibility inspector can't select any elements. |
|
I think this is because it is not perfect in GPUI itself. I wrote a small Swift wrapper for tests myself. It needs two actions:
So, on the first try, it only activates the AX tree (GPUI here is lazy), but it returns the wrong tree initially. It should wait until all components are updated and only after that return to AX's caller. If it will work fine for me, I will create a PR here 👍 |
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.
Summary
Role,aria_*attributes, andon_a11y_actionhandlers to all major UI components using the AccessKit integration in the latest GPUIRootcomponentRole::Applicationlandmark so the accessibility tree has a proper application root below Windowscript/run-story-macoshelper to build and launch Story gallery as a signed macOS.appbundle for VoiceOver testingComponent role mapping
ButtonButton/Linkaria_label,aria_selectedToggle/ToggleGroupButton+aria_toggled,ToolbarCheckboxCheckBoxaria_toggled,aria_labelRadio/RadioGroupRadioButton,RadioGrouparia_selected,position_in_set,size_of_setInputTextInput/MultilineTextInputNumberInputSpinButtonaria_numeric_valueSliderSlideraria_numeric_value, min/max,aria_orientation, Increment/Decrement a11y actionsTab/TabBarTab+aria_selected,TabListPopupMenu/AppMenuBarMenu,MenuBarMenuItemMenuItemaria_selectedDialog/AlertDialogDialog(configurable),AlertDialogAlertAlertProgressProgressIndicatoraria_numeric_value, min/maxList/ListItemList,ListItemaria_position_in_set,aria_size_of_set,aria_selectedTable/ Header / Body / Row / CellTable,RowGroup,Row,ColumnHeader,Cellaria_row_index,aria_column_indexAccordion/ item headerGroup,Button+aria_expandedGroupBoxGroupComboboxComboBoxaria_expandedDropdownButtonGroupStepper/StepperItemGroup,ListItemaria_position_in_setBreadcrumbItemLink/ListItemFormFieldGroupRootApplicationVerification guide
Prerequisites
AccessKit only builds the full accessibility tree when an assistive technology is active. Accessibility Inspector alone is not sufficient — you must enable VoiceOver first.
macOS — VoiceOver + Accessibility Inspector
# 1. Build and launch Story gallery as a signed .app bundle ./script/run-story-macosKey things to verify
AXButton, label matches button textAXCheckBox, value changes on clickAXButton,AXValuereflects checked stateAXPositionInSet/AXSizeOfSetAXTabGroupcontainingAXTabitems, selected tab hasAXValue = 1AXDialogwhen open, focus trapped insideAXSliderwithAXMinValue/AXMaxValue/AXValue, responds to VoiceOver Increment/DecrementWindows — NVDA
Linux — AT-SPI (Orca)
cargo run # Enable Orca, Tab through the window.🤖 Generated with Claude Code