Problem/Motivation
We should encourage developers to follow best practices for accessibility when building Drupal modules. The current Help Text Standards provide example code and a standard template for hook_help() implementations, which uses h3 as the heading level for section titles. The standard was adopted about 9 years ago, without a lot of discussion except along the lines of "better to have headers and a standard template than what we had before" on this issue:
#537828: Help text for core modules - update to conform to new standard
When hook_help() pages are output, they go on a page such as admin/help/link. Assuming a configuration like in the Standard install profile, with Seven theme and the usual blocks, the page structure has an H1 at the top for the page title, and then in the main content region, the next header is the H3 saying "About". There is no H2 on the page, except in the Toolbar area, which is outside the hierarchy of the main content region.
However, in order to follow best practices for accessibility, Techniques for WCAG 2.0: organizing a Page Using headings, sections should begin with an h2 and subsections an h3.
To facilitate navigation and understanding of overall document structure, authors should use headings that are properly nested (e.g., h1 followed by h2, h2 followed by h2 or h3, h3 followed by h3 or h4, etc.).
Proposed resolution
Update the following on the Help Text Standards documentation:
Documentation changes
1. Help page
Add a 'Headings' section.
2. ">Help Topic Standards
Add a link to the 'Heading' section that is added in 1 to the Help Topic Syntax Example.
Current text
Proposed text
Headings
- Use an
h2element to indicate major sections of your help page.- Should your sections contain subsections, Use an
h3element to indicate each subsection.- Do not skip heading levels. An
h2should be followed by anotherh2, or anh3.
Remaining tasks
Update proposal to include Help Topic standards, #22
- Update Help Text Standards documentation.
- Then patch Drupal core, at least, to change the headings to H2 in the modules' implementations of hook_help(). #3414263: Change help headings for WCAG 2.0
- A change record, noting hook_help() now uses improved heading levels, and encouraging contrib/custom module maintainers to do the same.
Coder changes
1. Link to Coder issue
| Comment | File | Size | Author |
|---|
Comments
Comment #2
jhodgdonSome additional information:
a) These standards are used for modules that implement hook_help().
b) Normally, this help is displayed on a page like
admin/help/link (for the Link module)
where, in the Seven theme, there is an H1 at the top for the page title ("Link"), and then in the main content region, the next header is the H3 saying "About". There is no H2 on the page, except in the Toolbar area, which is outside the hierarchy of the main content region.
c) The standards have been in place with a suggestion of an H3 for About, and an H3 for Uses, for about 9 years. They were adopted as "way better than what came before" (which was no headings at all, and no standard structure), without much discussion of the details of the struture, on this issue:
#537828: Help text for core modules - update to conform to new standard
I'll add these notes to the issue summary.
Comment #3
jhodgdonI am +1 for this change by the way.
Comment #4
andrewmacpherson commentedThanks for filing this, great issue summary.
After we update core modules hook_help(), a change record should explain this, and encourage contrib/custom modules to update theirs too.
Comment #5
andrewmacpherson commentedSo we can see how the proposed headings work out, this patch replaces H3 with H2 in hook_help() for modules beginning with A.
Comment #6
andrewmacpherson commented@jhodgdon - I see this issue is in coding standards project, but core patches would need to be against the drupal core project. Should we have a separate issue for the core patch? If we update the documentation page first, we could move this issue to the drupal core project afterwards.
Comment #7
andrewmacpherson commentedOne interesting thing I noticed is that some module help pages have a section for admin links. This list is generated automatically, and also has a H3.
This patch updates HelpController.php to make it use a H2 as well.
Before this patch:

After this patch:

Comment #8
jhodgdonRE #6, the normal course of action for coding standards issues is:
a) Get the community to agree on the coding standards change. (There's a defined process for that -- see the Coding Standards project page and links therein. https://www.drupal.org/project/coding_standards )
b) Formally adopt the coding standards change and update the coding standards documentation for it.
c) File a new Core issue and patch for coding standards.
Comment #9
andrewmacpherson commentedThanks, so the core patch will be a new issue. Meanwhile the patch in #7 at least demonstrates what we're proposing, but there's no need to finish it yet.
From the process:
Well it's +1 from me, then.
Comment #10
jhodgdonOK, then we have 2 active community members with +1 on this. I'll post a link in a couple of Slack channels to get more discussion, and we should leave this for a week or two to get more input if people are interested, and then we can tag with "needs announcement for final discussion".
Comment #11
alexdmccabe+1 from me!
Comment #12
jds1This gets a +1 from me too! Looks like a great idea.
Comment #13
mgiffordThis is great. What is needed to move this ahead?
Comment #14
jhodgdonWell, let's see -- the procedure is here: https://www.drupal.org/project/coding_standards
So it looks like we have finished the first two steps: create and issue and find at least 2 active people in the community who support it. So I think we can do step 3 and add the "needs announcement for final discussion" tag. Let's do it!
Comment #15
mgiffordOk, it looks like this is ready to go. We just need someone to make it happen. It's got the tag, how do we make it fixed?
Comment #16
mgiffordFixing tagging.
Comment #17
neeravbm commentedI am in favor of this change. According to Coding Standards, we should have completed #5. I don't see any update on #6 yet. How do we move this forward?
Comment #18
aaronmchaleComment #19
sushma9 commentedAdded a patch for the heading change of help from h3 to h2 for below modules:
Action, Aggregator, AutomatedCron, Ban, Basic Auth, Big Pipe, Block, Block Place, Book, Breakpoint, CK Editor, Color
Comment #20
sushma9 commentedThis patch has got heading changes for all core modules
Comment #21
quietone commentedThis was discussed at a coding standards meeting. #3380936: Coding Standards Meeting 2023-08-01 2100 UTC where the following points were raised.
I've updated the Issue Summary. In doing so I have removed two of the requested changes because that section of documentation, the example, was deleted. See https://www.drupal.org/node/632280/revisions/view/12277977/12369190
Comment #22
quietone commentedI now see that there is wiki page for 'Help Topic Standards'. I think these changes should also go there. Or is there a better way to have the same information in two places?
Setting to NW
Comment #23
quietone commentedUpdate the IS in preparation for announcing this one
Comment #24
andypostThis change is scriptable
Comment #25
larowlanComment #26
quietone commentedThis was discussed by the coding standards committee and we all agreed to do this.
I have updated the documentation per the issue summary.
Comment #27
quietone commentedWe also agreed that this isn't a Coding Standards issue, so moving to the Core queue.
Comment #28
quietone commentedThe followup to make the change is #3414263: Change help headings for WCAG 2.0
Comment #30
quietone commentedAdding credit for the discussion amongst some coding standing committee members.
Comment #31
longwaveThe patches are woefully out of date, please open a merge request instead and let's work on this against 11.x there.
Comment #32
longwaveOh I see, we are scripting the changes instead. But if we are doing that in another issue, what's this issue for - only updating docs?
Comment #33
longwaveHiding the patches so they don't confuse others like they did to me.
Comment #34
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
Comment #35
quietone commentedYes, this is about documentation.
On reflection, the change record should be on this issue as it is the changing the Standards documentation.
Comment #36
quietone commentedI added a change record here.
Comment #37
andypostThank you, back to RTBC
Comment #38
quietone commented@andypost, thank you!
The documentation is updated and the implementation issue is also complete. The remaining piece is to publish the CR and set this to Fixed. I double checked the docs and the CR and I don't see anything that needs to be changed. Since there has been no further feedback and even though I wrote the CR I am going to publish and set this to Fixed.
Thank you to everyone here for improving Drupal!