fix: resolve a11y errors#3347
Open
aresnik11 wants to merge 14 commits into
Open
Conversation
|
View your CI Pipeline Execution ↗ for commit dd03040 ☁️ Nx Cloud last updated this comment at |
|
Collaborator
|
📬 Published Alpha Packages:
|
Contributor
|
🚀 Styleguide deploy preview ready! Preview URL: https://6a2094886af745a9cec346a7--gamut-preview.netlify.app |
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.
Overview
This PR fixes Storybook accessibility violations surfaced after enabling the a11y addon's
errortest mode (previouslytodo). Changes fall into three buckets: component-level a11y fixes, story/documentation updates so examples demonstrate correct patterns, and unit test updates to match the new behavior and satisfy codecov.Component changes
ConnectedFormGroup
ConnectedFormGroupnow passeshtmlFor={${name}-${uniqueIdSuffix}}to their underlying form elements and the same value is passed to the form labelConnectedFormGrouprenders a label viaFormGroupLabelwhich setshtmlFor={id || name}but there was no id to match thathtmlForwithin the input, so the label association did not work. Most of the underlying form elements haveid={id || rest.htmlFor}so settinghtmlForupstream matches them upList
ListRownow explicitly setsas={isTable ? 'tr' : 'li'}on the row element.<tr>elements for correct table semantics.DataList
TableRowrenders screenreader-only"Loading data"text for columns withtype: 'header'while in a loading state.Tabs
TabNavLinkdefault role changed from'tab'to'button'.TabNavLinkis used insideTabNav(<nav>) for link-based navigation, not inside atablist. Usingrole="tab"was semantically incorrect and failed a11y checks. Consumers can still override via the role prop.Menu
MenuSeparator: movedrole="separator"from the outer<li>to the inner visual divider<Box>.<li>withrole="separator"is not valid; the separator role belongs on the element that visually represents the divider.MenuItem: icon-only menu items now fall back to an explicitaria-labelprop when nolabelis provided.Tag
Tagdismiss button always receives anaria-label(Dismiss ${children} Tag), even when disabled.aria-label=""on a disabled dismiss button removed its accessible name entirely.Storybook & documentation updates
Stories were updated to pass a11y checks and demonstrate correct labeling patterns:
Form inputs —
htmlFor→idmigrationAcross
Input,Select,SelectDropdown,TextArea,FormGroup,GridForm, andConnectedFormstories:htmlFor/nameon input components withidon the input andhtmlForon the parentFormGroup.htmlForon FormGroup andidon the input.aria-labelwhere needed.Other story fixes
FormGroupdecorator so the textarea has a visible label.labelprop.aria-labelto the demo toggle button.tabIndex={0}to scrollable overflow examples so keyboard users can focus them.Boxfor sufficient color contrast.bg="green"token tobg="green-400".aria-labelto icon-only avatar example.labelprop from Input; fixed typo inhtmlFor.<label htmlFor>+ matchingid.PR Checklist
Testing Instructions
ConnectedForm / ConnectedFormGroup
Organisms/ConnectedFormstories.FormGroupLabel— focus should move to the associated input (label–input association via generated id:{name}-{useId suffix}).idprop on a field, the label should still associate correctly.ConnectedCheckbox
htmlForuses the same unique suffix pattern as other connected fields.DataList / DataGrid (loading)
loading={true}and aheader-type column.List (table mode)
<tr>(not invalid<li>inside<table>).Menu
Box, not the<li>wrapper (no nested interactive/separator conflict).aria-labelon an icon-only item, it should be used when theariaLabelprop is absent.TabNavLink
role="button"(link styled as tab button for nav contexts).role="tab"still works when passed.Tag (selection variant)
aria-label="Dismiss {children} Tag"when the tag is disabled (not an empty string).PR Links and Envs