From 467d994123c4a5aa8e23260fb5e460a958a5822a Mon Sep 17 00:00:00 2001 From: bwang Date: Mon, 6 Jun 2022 17:00:38 -0500 Subject: [PATCH] Follow-up: Update menu label elements - Update the modern menu template to avoid using aria-hidden on the `label` element, and avoid using a `label` element when no checkbox is present. - Revert legacy menu template to use h3 elements Bug: T301051 Change-Id: I6ab10e35f0d67d70877e55cca5a512c2af4cb972 --- includes/templates/Menu.mustache | 17 +++++++---------- includes/templates/legacy/Menu.mustache | 11 ++++++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/includes/templates/Menu.mustache b/includes/templates/Menu.mustache index 234cba44..8ab35c44 100644 --- a/includes/templates/Menu.mustache +++ b/includes/templates/Menu.mustache @@ -4,10 +4,9 @@
{{! - Dropdown menus use the checkbox hack and require `input` and `label` elements - The accessible label is applied to the `input` which is semantically a button - The `label` element is used as a visual button and is hidden from screenreaders - to reduce verbosity, as it's contents are already used or overridden in the `input` element + Dropdown menus use the checkbox hack and require `input` and `label` elements. + `aria-label` is applied to the `input` which is semantically a button. + The `label` element is used as a visual button. }} {{#is-dropdown}} {{/is-dropdown}} {{! - Portal menus also require `label` elements, but these - should not be hidden and should have an accessible label + Portal menus also require a label }} {{#is-portal}} - +

{{/is-portal}}
{{{html-before-portal}}} diff --git a/includes/templates/legacy/Menu.mustache b/includes/templates/legacy/Menu.mustache index 4b699107..c6d71421 100644 --- a/includes/templates/legacy/Menu.mustache +++ b/includes/templates/legacy/Menu.mustache @@ -13,7 +13,6 @@ class="{{#checkbox-class}}{{.}} {{/checkbox-class}}vector-menu-checkbox" aria-labelledby="{{id}}-label" /> - {{/is-dropdown}} + {{/is-dropdown}} + {{^is-dropdown}} +

+ {{{html-vector-heading-icon}}}{{label}} +

+ {{/is-dropdown}}
{{{html-before-portal}}}
    {{{html-items}}}