Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow headings within label elements #1304
Update the spec to permit headings as part of the
In #724 the spec was changed to allow headings as permitted children of legends, but this same change was not also extended to labels. This meant that including a heading as part of a legend is valid, but including a heading as part of a label is not.
This led to an inconsistent experience when building interfaces where the label for a form field or fieldset is also the heading for the page – with a fieldset, the heading could be nested inside the legend, but with a single field the label instead needed to be nested inside the heading. Unifying the behaviour of the two elements so that both permit headings reduces the complexity for the developer.
scottaohara left a comment
While your test cases indicate there is no issues for screen readers interpreting this isolated pattern (thank you again for the detail you went into with those), this PR doesn't yet address how this change might affect the semantics of the
A few points to consider:
Additional examples and notes may need to be outlined to indicate to authors how they should expect this sort of pattern to be interpreted by user agents (browser and screen readers)
To wrap up...
This seemingly minor change will increase the complexity of appropriate usage of labels, not decrease it.
To more directly answer your question about why this was an appropriate change for
Due to the issues I've outlined I do not think this change should be accepted without much more consideration and tests that provide evidence this is a needed change beyond this specific use case.