fix(a11y): add accessible labels to EmbedCodeContent height/width inputs#41995
Conversation
WCAG 2.1 SC 1.3.1 — Level A.
Code Review Agent Run #92fc67Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Per self-review: prefer a real <label htmlFor> over aria-label since visible label text already existed, and wire up the previously-unused id="embed-width" instead of duplicating the string in aria-label. WCAG 2.1 SC 4.1.2 (Name, Role, Value) — Level A.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41995 +/- ##
=======================================
Coverage 65.03% 65.04%
=======================================
Files 2742 2742
Lines 153426 153426
Branches 35206 35206
=======================================
+ Hits 99787 99792 +5
+ Misses 51732 51727 -5
Partials 1907 1907
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #bf6987Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
msyavuz
left a comment
There was a problem hiding this comment.
Ant design way of doing this was to use Form.Item as https://ant.design/components/form#examples. But this should work as well
Summary
superset-frontend/src/explore/components/EmbedCodeContent.tsxrenders two<Input type="number">fields (Chart height, Chart width) with only a sibling<Typography.Text>as a visual label — no<label htmlFor>,aria-label, oraria-labelledbytying the label to the input programmatically.<Typography.Text>in a native<label htmlFor>and wires it to the input viaid(the width input already had an unusedid="embed-width"set up for exactly this, never connected — the height input gets a matchingid="embed-height").<label>also gains click-to-focus for sighted mouse users, as a side benefit).WCAG 2.1 SC 4.1.2 (Name, Role, Value) — Level A: the accessible name of a form control must be programmatically determinable.
Test plan
EmbedCodeContent.test.tsxassertingscreen.findByLabelText('Chart height')andscreen.findByLabelText('Chart width')both resolve.