Make WordPress Core

Opened 7 weeks ago

Closed 11 days ago

#66195 closed defect (bug) (fixed)

Twenty Twenty Three: add aria-label to default primary menu

Reported by: joedolson Owned by: joedolson
Priority: normal Milestone: 7.2
Component: Bundled Theme Version:
Severity: normal Keywords: commit
Cc: Focuses: accessibility

Description

Part of the process of moving bundled themes to meet new accessibility-ready standards.

Add an aria-label for the default primary menu.

Attachments (2)

66195-before.png​ (84.0 KB ) - added by rahultank 6 weeks ago.
Header nav, before patch
66195-after.png​ (86.8 KB ) - added by rahultank 6 weeks ago.
Header nav, with patch (PR 13780)

Download all attachments as: .zip

Change History (19)

#1 @joedolson
7 weeks ago

  • Owner set to joedolson
  • Status new → accepted

This ticket was mentioned in ​PR #13780 on ​WordPress/wordpress-develop by ​@joedolson.


7 weeks ago
#2

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/66195

Use of AI Tools

​@mukesh27 commented on ​PR #13780:


7 weeks ago
#3

Seems it shows PHP code instead of label.

@rahultank
6 weeks ago

Header nav, before patch

@rahultank
6 weeks ago

Header nav, with patch (PR 13780)

#4 @rahultank
6 weeks ago

Patch Testing Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/13780

Environment

  • WordPress: 7.1.2 with Twenty Twenty-Three 1.7 from WordPress.org (before) / trunk with PR #13780 (after), both in WordPress Playground
  • Browser: Google Chrome 153.0.8010.52
  • OS: Linux
  • Theme: Twenty Twenty-Three 1.7
  • MU Plugins: None
  • Plugins: None

Steps taken

  1. Activated Twenty Twenty-Three.
  2. Opened the front page and inspected the header navigation <nav> element.
  3. Repeated the same steps with the patch applied.
  4. ❌ Patch is not solving the problem yet.

Results

  • Before the patch: the header <nav> has no aria-label attribute.
  • With the patch: the header <nav> has aria-label="<?php esc_html_e( 'Primary', 'twentytwentythree' ); ?>", so the PHP code is output as the label text instead of "Primary". This matches comment:3 on the PR.

Expected result

The header <nav> has a translatable accessible name, for example aria-label="Primary".

Additional Notes

parts/header.html is a block template part, and PHP is not executed in .html template files, so esc_html_e() is saved as a literal string in the ariaLabel attribute.

Screenshots/Screencast with results

Before patch:
Header nav, before patch

With patch:
Header nav, with patch (PR 13780)

This ticket was mentioned in ​PR #14091 on ​WordPress/wordpress-develop by ​@mukesh27.


5 weeks ago
#5

Trac ticket: https://core.trac.wordpress.org/ticket/66195

Use of AI Tools

No

​@mukesh27 commented on ​PR #14091:


5 weeks ago
#6

https://github.com/user-attachments/assets/4188b906-39c9-45f9-b043-76f989db8734

​@mukesh27 commented on ​PR #13780:


5 weeks ago
#7

Closing in favour of #14091. Feel free to reopen.

#8 @joedolson
5 weeks ago

  • Keywords commit added

#9 @joedolson
5 weeks ago

  • Resolution → fixed
  • Status accepted → closed

In 64303:

Twenty Twenty Three: Add aria-label to primary menu.

HTML templates can't contain translatable strings, and the primary menu needs a default ARIA label. Move the primary navigation into a hidden pattern and add the ARIA label.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/14091.

Props joedolson, rahultank, mukesh27, dhruvang21.
Fixes #66195.

This ticket was mentioned in ​PR #14629 on ​WordPress/wordpress-develop by ​@mukesh27.


3 weeks ago
#10

Trac ticket:

Use of AI Tools

N/A

​@joedolson commented on ​PR #14629:


3 weeks ago
#11

This seems like a very straightforward fix to me; I'd like to hear @tjcafferkey confirm that it resolves the Woo issue, however.

#12 @joedolson
3 weeks ago

  • Resolution fixed
  • Status closed → reopened

Re-opening to address concerns raised by Woo about their ability to extend the header.

​@codebytom commented on ​PR #14629:


3 weeks ago
#13

hey both, doesn't seem to fix the issue. you can test this yourselves by simply installing WooCommerce and activating the TT3 theme.

I believe the issue will be fixed if you add the category header to the pattern meta.

thanks!

#14 @peterwilsoncc
3 weeks ago

  • Keywords has-patch commit removed

​@mukesh27 commented on ​PR #14629:


3 weeks ago
#15

After the last commit mini cart shows fine.

https://github.com/user-attachments/assets/03151eb5-9cf4-4b2a-b0ae-71fdefbb97af

#16 @joedolson
11 days ago

  • Keywords commit added

#17 @joedolson
11 days ago

  • Resolution → fixed
  • Status reopened → closed

In 65213:

Twenty Twenty Three: Move navigation from a hidden to a header pattern.

Hidden patterns and categorized patterns behave differently for extenders, and the previous change prevented content from being inserted into the header. Follow up to [64303].

Developed in ​https://github.com/WordPress/wordpress-develop/pull/14629.

Props joedolson, mukesh27, peterwilsoncc, codebytom.
Fixes #66195.

Note: See TracTickets for help on using tickets.