Skip to content
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

Appropriate use of fieldset/div, legends, accessibility advice #17266

Closed
wants to merge 2 commits into from
Closed

Appropriate use of fieldset/div, legends, accessibility advice #17266

wants to merge 2 commits into from

Conversation

patrickhlauke
Copy link
Member

Use more generic <div> for single form controls, use <fieldset> and
<legend> for radio button groups and checkboxes (where appropriate).
Include accessibility advice from v3
Fixes #17248

@patrickhlauke
Copy link
Member Author

@mdo note that this introduces one problem with the current styling of <legend>.
capture
As semantically, the use of <legend> in this case is correct (unless we want to go down a further route of giving the original <label> elements an id and then tying them explicitly to each radio/checkbox using aria-describedby (which would then require extra explanation of why it's done that way - for styling ease), i'd suggest coming up with a modifier class for <legend> to style it the same as regular <label> in specific situations...thoughts?

@patrickhlauke
Copy link
Member Author

/cc @cvrebert

@cvrebert cvrebert added the v4 label Aug 24, 2015
@XhmikosR
Copy link
Member

@patrickhlauke: can you rebase?

Use more generic `<div>` for single form controls, use `<fieldset>` and
`<legend>` for radio button groups and checkboxes (where appropriate).
Include accessibility advice from v3
Fixes #17248
@patrickhlauke
Copy link
Member Author

@XhmikosR done, i think (my git-fu isn't as strong as it should be, so force-pushed in the end). still waiting for @mdo's thoughts about the use of <legend> as per the screenshot above...

Port `.help-text` advice and example for `.text-muted`, first stab at
generalising the validation accessibility callout (in the absence of
glyphicons now) - the latter is not perfect, but better than nothing at
this stage
@XhmikosR
Copy link
Member

XhmikosR commented Sep 5, 2015

Looks good git-wise :)

@mdo
Copy link
Member

mdo commented Sep 5, 2015

While it's technically right, most folks won't build their forms this way—with the <legend>—but if we're using classes more for common patterns, that shouldn't be too much of an issue.

@patrickhlauke
Copy link
Member Author

@mdo does this mean it's good to be merged, and we'll fix things later with classes? at a stretch, as it's an example of grid, i could probably let those two legends slide (but maybe add a comment to that effect in the HTML). or i could give those two bits of text an id and associate the radios/checkbox with aria-describedby (as an ARIA-based alternative to <fieldset>/<legend>), but I worry this would then need further explanation in prose...

@mdo
Copy link
Member

mdo commented Nov 13, 2015

I mean we need to use classes to style these form labels so they don't get all screwed up :).

@cvrebert
Copy link
Collaborator

cvrebert commented Feb 8, 2016

@patrickhlauke Does adding .form-control-label to the <legend>s happen to work?

@patrickhlauke
Copy link
Member Author

As rebasing was starting to get messy, I've made a successor pull request #19277

@mdo mdo mentioned this pull request May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants