Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change guidance on sections and landmarks in HTML
The current guidance on use of `<section>` tags is unclear because: - the approach it recommends (using `aria-labelledby` to use the heading as their accessible name) creates a region landmark but the examples seem to show content that shouldn't be split off into one - from looking through a lot of GDS repos, I couldn't find any code following this pattern - it seems to clash with the current HTML5 spec', which now says you should use `<section>` tags to wrap groupings of content marked by a heading without use of `aria-labelledby` to make the heading the `<section>`s accessible name See HTML5 spec on `<section>`: https://html.spec.whatwg.org/multipage/sections.html#the-section-element By 'region landmark', I mean an element with `role="region"`. The original opinion that this guidance is unclear was stated in this issue: #617 I think a major cause of this confusion comes from the current guidance having been written when the HTML5 spec' still said that `<section>`s should be used with `<h1>`s to create the document outline, something never implemented in any browser: https://www.tpgi.com/html5-document-outline/) This has since been changed: whatwg/html#7829 These changes intend to ensure guidance around use of `<section>` tags is clearer by only referencing them in the bit on region landmarks and making it clear that using them in other ways (without assigning an accessible name) removes any semantics they add. Worth noting that these changes gratefully borrow from https://www.scottohara.me/blog/2018/03/03/landmarks.html
- Loading branch information