-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the fieldset structure #51510
Fix the fieldset structure #51510
Conversation
This reverts commit ffe0554.
@@ -146,46 +146,42 @@ export function LabelsInput({ | |||
const width = `${inputWidth}px`; | |||
const inputSize = 'medium'; | |||
return ( | |||
<Fieldset gap={labels.length > 0 ? 2 : 1}> | |||
<Stack gap={1}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering how it broke the semantic structure of fieldset and legend, I managed to find that indeed:
The first element inside the fieldset must be a legend element, which provides a label or description for the group.
https://www.w3.org/TR/WCAG20-TECHS/H71.html
FWIW, I did a quick check and this could also be fixed by getting rid of this Stack
and changing the gap on Fieldset
to always be 2, with just a minimal difference in spacing compared to the original implementation while keeping spacing defined on parents and not individual children.
This PR reverts a change that was implemented during the code review of #51457, because it broke the semantic structure of fieldset and legend. The tests of the follow-up PR #51458 relied on this structure to identify fields by the legend.
This PR is intended to be backported to v17, v16, and v15 manually along with the backports of #51457.