diff options
| author | Luis González <lgonzalez@vauxoo.com> | 2020-03-15 21:28:43 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2020-03-25 09:57:53 +0000 |
| commit | 680b2797d8809f48718ad3a04bbde86dbd197063 (patch) | |
| tree | 332e19a806d81641c76f2aa5dbec92f9734419e9 /addons/web/static/src/xml/base.xml | |
| parent | a1654e59b9a0f07dc659b790171bae2500bd1adc (diff) | |
[FIX] web: Add missing aria attributes to selectable menu items
Some menus contain items that are selected/checked when they're
activated, e.g. when a filter is applied, the menu item corresponding to
that filter is checked. However, that information of what items are
checked and what don't, is not reported correctly using aria attributes.
To solve the above, the following is performed:
- Attribute `aria-checked` is set accordingly, usually using the same
logic as the clas `selected`
- Attribute `role` is set to `menuitemcheckbox` or `menuitemradio`
instead of `menuitem`, so `aria-checked` is applicable
This applies on the following cases:
- Standard topbar's menus: Filter, Group by and Favorites
- The company switcher widget
closes odoo/odoo#48301
X-original-commit: 64c0b47c0e8e8fdd3fa9b1bc13f2b49b6f49f4e1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web/static/src/xml/base.xml')
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 392025436f5..b9129309c6e 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -219,7 +219,8 @@ <t t-if="canBeOpened"> <a class="o_menu_item_parent dropdown-item" t-att-class="{ selected: props.isActive }" - role="menuitem" + t-att-aria-checked="props.isActive ? 'true' : 'false'" + role="menuitemcheckbox" href="#" t-ref="fallback-focus" t-on-click.prevent="state.open = !state.open" @@ -237,7 +238,8 @@ <li class="o_item_option" role="menuitem"> <a class="dropdown-item pl-5" t-att-class="{ selected: option.isActive }" - role="menuitem" + t-att-aria-checked="option.isActive ? 'true' : 'false'" + role="menuitemcheckbox" t-att-href="option.url or '#'" t-esc="option.description" t-on-click.prevent="trigger('item-selected', { item: props, option: option })" @@ -249,7 +251,8 @@ </t> <a t-else="" class="dropdown-item" t-att-class="{ selected: props.isActive, [props.className]: props.className }" - role="menuitem" + t-att-aria-checked="props.isActive ? 'true' : 'false'" + role="menuitemcheckbox" t-att-href="props.url or '#'" t-on-click.prevent="trigger('item-selected', { item: props })" > |
