mediawiki-skins-Vector/includes/templates/Menu.mustache
bwang 467d994123 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
2022-06-06 23:59:13 +00:00

46 lines
1.3 KiB
Plaintext

{{!
See @typedef MenuDefinition
}}
<div id="{{id}}"{{#class}} class="{{.}}"{{/class}} {{{html-tooltip}}} {{{html-user-language-attributes}}}>
{{!
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}}
<input type="checkbox"
id="{{id}}-checkbox"
role="button"
aria-haspopup="true"
data-event-name="ui.dropdown-{{id}}"
class="{{#checkbox-class}}{{.}} {{/checkbox-class}}vector-menu-checkbox"
{{#aria-label}}aria-label="{{.}}"{{/aria-label}}
/>
<label
id="{{id}}-label"
for="{{id}}-checkbox"
class="vector-menu-heading{{#heading-class}} {{.}}{{/heading-class}}"
>
{{{html-vector-heading-icon}}}<span class="vector-menu-heading-label">{{label}}</span>
</label>
{{/is-dropdown}}
{{!
Portal menus also require a label
}}
{{#is-portal}}
<p
id="{{id}}-label"
class="vector-menu-heading{{#heading-class}} {{.}}{{/heading-class}}"
{{#aria-label}}aria-label="{{.}}"{{/aria-label}}
>
{{{html-vector-heading-icon}}}<span class="vector-menu-heading-label">{{label}}</span>
</p>
{{/is-portal}}
<div class="vector-menu-content">
{{{html-before-portal}}}
<ul class="vector-menu-content-list">{{{html-items}}}</ul>
{{{html-after-portal}}}
</div>
</div>