Opened 7 weeks ago
Closed 6 days ago
#66189 closed defect (bug) (fixed)
Twenty Twenty Four: Missing nav aria-labels
| Reported by: | joedolson | Owned by: | joedolson |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Bundled Theme | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: | accessibility |
Description
Part of the process of moving bundled themes to meet new accessibility-ready standards.
Some of the template parts in Twenty Twenty Four declare nav menus without a default aria-label.
Attachments (4)
Change History (12)
This ticket was mentioned in PR #13763 on WordPress/wordpress-develop by @joedolson.
7 weeks ago
#2
- Keywords has-patch added
#2
@
6 weeks ago
Patch Testing Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/13763
Environment
- WordPress: 7.1.2 with Twenty Twenty-Four from WordPress.org (before) / trunk with PR #13763 and its bundled Twenty Twenty-Four (after), both in WordPress Playground
- Browser: Google Chrome 153.0.8010.52
- OS: Linux
- Theme: Twenty Twenty-Four
- MU Plugins: None
- Plugins: None
Steps taken
- Activated Twenty Twenty-Four.
- Created a page containing the two changed patterns:
twentytwentyfour/footer-centered-logo-navandtwentytwentyfour/hidden-sidebar. - On the front end, checked the
aria-labeland the classes of every<nav>element (header, page content and footer). - Repeated the same steps with the patch applied.
- ❌ Patch is only partly working.
Results
- Footer with centered logo and navigation: ✅ the navigation now has
aria-label="Footer"(before:aria-label=" 2"). Its layout is unchanged. - Header (
parts/header.html): ❌ the navigation still has noaria-label. It also lost its layout classes: before it hadis-horizontal items-justified-right is-content-justification-right, with the patch onlywp-block-navigation is-layout-flexremains. - Hidden sidebar ("Useful Links"): ❌ the navigation still has no real label (
aria-label=" 2", before" 3"). It also lost its attributes: theis-verticalclass is gone, so the links are shown side by side instead of as a vertical list. - The footer part navigations (About, Privacy, Social Media) are unchanged, as expected.
Additional Notes
- In
parts/header.htmlandpatterns/hidden-sidebar.phpthere is no comma between the newariaLabelvalue and the next attribute (..."Primary', 'twentytwentyfour' ); ?>""layout"and...'Sidebar', ... ?>""overlayMenu"), so the block attributes JSON is invalid and all attributes of those two navigation blocks are dropped. parts/header.htmlis a static template part, so the<?php esc_attr_e() ?>call there is not executed; the file served from the PR build contains the PHP code as text.
Expected result
All three navigation blocks get a meaningful aria-label (Primary, Footer, Sidebar) and keep their existing layout and styles.
Screenshots/Screencast with results
Page with the changed patterns, before patch:

Page with the changed patterns, with patch:

@joedolson commented on PR #13763:
5 weeks ago
#3
Thanks for suggesting the hidden template part; I'm not sure I would have thought of that.
#4
@
5 weeks ago
Test Report
Description
This report validates whether the indicated patch works as expected. It re-tests the PR after the three commits from Oct 11, which addressed the problems in comment:2.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/13763 (head 0cb1647)
Environment
- WordPress: 7.2-alpha-63166-src (trunk e8a9e23)
- PHP: 8.3.33
- Server: wordpress-develop Docker environment
- Browsers: Google Chrome (manual check with DevTools), Chromium (Playwright, automated check)
- OS: macOS
- Theme: Twenty Twenty-Four 1.6
- Plugins: none
Steps taken
- Activated Twenty Twenty-Four.
- Created a page with the two changed patterns:
twentytwentyfour/footer-centered-logo-navandtwentytwentyfour/hidden-sidebar. - On the front end, inspected each
<nav>element in the Chrome DevTools Elements panel. Recorded itsaria-label, its classes and its list direction. A Playwright script checked the same values for every<nav>on the page. - Applied the PR and repeated step 3.
- Opened the Header template part in the Site Editor and checked the Navigation block.
Actual Results
✅ The patch works as expected. Every navigation now has a real label, and no navigation changed its layout.
| Navigation | Before | After | Layout |
|---|---|---|---|
| Header (parts/header.html) | no aria-label | "Primary" | unchanged (horizontal, justified right) |
| Footer with centered logo pattern | " 2" | "Footer" | unchanged |
| Hidden sidebar pattern ("Useful Links") | " 3" | "Sidebar" | unchanged (vertical list) |
| Footer part: About, Privacy, Social Media | labelled | labelled | unchanged |
- No raw PHP is printed on the page.
- The problems from comment:2 are fixed. The header navigation now has a label, and the header and sidebar navigations keep all their layout classes.
- In the Site Editor, the Header template part loads with no invalid blocks. Its Navigation block has
ariaLabel: "Primary"and the original layout.
Additional Notes
- Tester tip: the new
hidden-navigation.phpfile is not picked up until the theme pattern cache is cleared. Without that, the header shows no navigation at all. The cache is kept unlessWP_DEVELOPMENT_MODEisthemeorall, and I cleared it withwp eval 'wp_get_theme()->delete_pattern_cache();'. A real theme update changes the version and refreshes the cache, so users are not affected. The theme version should still be bumped when this is committed. - The latest review on the PR asks to remove the
CategoriesandBlock Typeslines fromhidden-navigation.php. That change is still open. It does not affect the results above.
Supplemental Artifacts
Before, header navigation has no aria-label
After, header navigation has aria-label="Primary"
After, centered logo footer pattern has aria-label="Footer"
After, hidden sidebar has aria-label="Sidebar" and keeps is-vertical
@joedolson commented on PR #13763:
6 days ago
#5
These changes are materially consistent with other themes and do not materially change the previously tested changes. My testing demonstrates that they work as expected without changing existing behaviors, so approving.


Add omitted aria-labels.
Trac ticket: https://core.trac.wordpress.org/ticket/66189
Use of AI Tools