Use consistent header element nesting for accessibility - #2319
Open
sjd210 wants to merge 7 commits into
Open
Conversation
sjd210
marked this pull request as ready for review
August 20, 2026 15:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have historically used header elements
<h1>-<h6>for styling purposes, however these elements are also important for navigation, especially for screenreaders.According to the WCAG standards, in order to make this navigation work properly, headings should start with a single
<h1>(after any navigation headings if they exist, which they don't for us), with sequentially increasing numbers for each nested subsection, and equal numbers for sections of the same rank/importance.Most pages on both sites have violated this, so this requires quite a lot of changes to resolve, however all these changes are very straightforward. Each current
<h*>element essentially falls into one of the following camps:<PageTitle>as our single<h1>)<h3>-><h2 className="h3"><h3>-><div className="h3">The only exceptions to this are:
<h1>(since a modal represents its own document) or<h2>(since it is on the same wider page as a<h1>already). I have chosen to follow Bootstrap's example and set the modal-title to<h1>and label accordingly from there, but either would doquestion-validation-response, which was barely using<h1>for its styling anyway so a newresponse-headingclass has been added in its placeclassNamesfor styling. e.g.<h2 className={siteSpecific("h4", "h3")}>(If there are any violations left, or for any that are generated in the future, they should now be individual cases that can be quickly fixed rather than a fundamental disregard for the header structure. I checked manually for non-trivial cases, but can't guarantee this caught everything - especially for elements that should be marked as headings but did not already use a
<h*>tag).