[wp-trac] [WordPress Trac] #31527: Bundled themes: Add ARIA attributes to menu toggle

WordPress Trac noreply at wordpress.org
Sat Mar 14 04:53:36 UTC 2015


#31527: Bundled themes: Add ARIA attributes to menu toggle
----------------------------------------------+----------------------------
 Reporter:  davidakennedy                     |       Owner:  lancewillett
     Type:  enhancement                       |      Status:  assigned
 Priority:  normal                            |   Milestone:  4.2
Component:  Bundled Theme                     |     Version:  4.1
 Severity:  normal                            |  Resolution:
 Keywords:  4.2-beta has-patch needs-testing  |     Focuses:  accessibility
----------------------------------------------+----------------------------

Comment (by davidakennedy):

 Replying to [comment:18 lancewillett]:
 > Second pass at Twenty Thirteen and Twenty Fourteen based on
 davidakennedy feedback.
 >
 > The search toggle changes to be done separately.

 @lancewillett I retested these both and they work as expected. Great job!

 I found one wrinkle that I didn't think of before. If a custom menu is not
 assigned, the `id` won't be there to match the `aria-controls`. In that
 case, it relies on `wp_page_menu` instead of `wp_nav_menu`. I don't think
 `wp_page_menu` has a parameter to add an `id`, so we'd have to do
 something like:

 {{{
 /**
  *  Add ID attributes to the first <ul> occurence in wp_page_menu.
  *  Helps ARIA attributes match proper elements.
  */
 function twentyfourteen_add_menuid( $ulid ) {
         return preg_replace( '/<ul>/', '<ul id="primary-menu">', $ulid, 1
 );
 }
 add_filter( 'wp_page_menu','twentyfourteen_add_menuid' );
 }}}

 Not the cleanest solution, and maybe there's a better way I'm not thinking
 of right now. Sorry I didn't think of this before.

 Thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31527#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list