-
Notifications
You must be signed in to change notification settings - Fork 68
Accessibility labels for form fields and fieldsets #805
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
base: main
Are you sure you want to change the base?
Conversation
…plying fieldset to checkboxes/radios also changed the default form to not include any ID as that would cause invalid HTML if there are multiple forms on one page.
…el to wrap to new line for terms agreement
|
Changes: Tested:
|
| }), | ||
| ' ', | ||
| label | ||
| m('span', label) |
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.
Why do we wrap the label in <span> here now?
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.
if i don't, it puts on the same line as the already very long agree to terms text.
I tried to add ' ' and '\n' and that did nothing...
| ? field | ||
| : isNested | ||
| ? (hasLabel | ||
| ? m('label', [config.label, field]) |
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.
Should we include a <span> or something here to make it a tiny bit easier to style the label text or have it be on a separate line from the field by default?
I think a lot of themes used to have display: block on the <label> element, resulting in a neat line-break between the label text and the input field. After this change, a lot of themes will have the input field on the same line as the label unless their input is display: block.
We should also check the CSS themes we ship to see what we're doing.
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.
Good idea
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.
and styles builder possibly as well, will click around
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.
added the span around text inside the label
made some changes to the default themes but warrants more testing.
also need to update the styles builder
…Also some CSS changes to target that span instead of label
|
I've put it back in draft mode now that I realize we have to update the styles builder too |
|
reminder for myself that the CSS changes also need to keep the old css in place for existing forms. |
What I changed and tested > see comment below.
I propose to wrap every input in its label, that way we don't need to deal with ID's
this way we prevent any issues with duplicated IDs and are still w3c accessible compliant by Associating labels implicitly
https://www.w3.org/WAI/tutorials/forms/labels/#using-aria-label
to this end I
Removed the ID from the default form content
Wrapped inputs in their label
Added "fieldset" around checkbox and radios with the agree to terms excluded as that has only 1 choice it can still be wrapped in label
removed the wrap in P option for "fieldset" as a fieldset will close the p / can't be wrapped in p
this would close Small tweak for accessibility (currently fails two WCAG guidelines) #640