UI: Add Form best practices Storybook page - #82197
Conversation
|
Size Change: 0 B Total Size: 7.92 MB |
|
Flaky tests detected in 09f89ca. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33415301078 two users concurrently move list items (RTC WebSocket) in
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
ciampo
left a comment
There was a problem hiding this comment.
LGTM 🚀
Left one non-blocking comment.
| * legend for the group. Give each `InputControl` its own `label` and set | ||
| * `hideLabelFromVision` so only the group label stays visible. | ||
| */ | ||
| export const LabelingComposedComponents: StoryObj = { |
There was a problem hiding this comment.
Nit: The fields show lb and oz, but their accessible names are Pounds and Ounces, so voice-control users cannot reliably target them using the visible text.
Should we include the unit in each label, such as label="lb, pounds", and clarify that labels should only be visually hidden when other visible text still identifies each control?
What?
Adds a Form Best Practices page under Design System ▸ Components ▸ Form in Storybook.
Why?
People composing several controls under one visible group label need a documented accessible pattern. The Form primitives overview already tells authors to prefer a
*Control. This page shows that composition inside a fieldset.How?
Adds
packages/ui/src/form/stories/best-practices.mdxandpackages/ui/src/form/stories/best-practices.story.tsx. The example usesFieldsetfor the group label andInputControlwithhideLabelFromVisionfor each field, so each input keeps a native label without a second visible one. Hidden labels include the visible unit (lb, pounds) so voice-control users can target the text they see.Testing Instructions
lbandozsuffixes, and no visible Pounds or Ounces labels.lb, pounds,oz, ounces) via its hidden label.Screenshots