From fcfc83b66c29d7bb3bd05b54f53fa26c8c85db00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Gonz=C3=A1lez?= Date: Sat, 13 Mar 2021 18:11:00 +0000 Subject: [PATCH] [FIX] web: Aria attributes on buttons Export All & optional columns Some aria attributes were missing or incorrectly set on these new buttons: - The button "Export All" was missing an `aria-label` attribute - The button to show/hide optional columns was also missing an `aria-label` attribute, and its menu items (checkboxes to show/hide columns) were missing a proper role - Ever since the debug manager was added in frontend on 73327db0656b, the `aria-label` attribute was not being rendered correctly on the button to open developer tools closes odoo/odoo#70433 X-original-commit: ac3e0fcd32d66d6e0bacfabd2d224805d92dbfd1 Signed-off-by: Nicolas Lempereur (nle) --- addons/web/i18n/web.pot | 14 ++++++++++++++ addons/web/static/src/js/core/dom.js | 3 +++ .../web/static/src/js/views/list/list_renderer.js | 2 ++ addons/web/static/src/xml/base.xml | 2 +- addons/web/static/src/xml/debug.xml | 7 +++++-- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/addons/web/i18n/web.pot b/addons/web/i18n/web.pot index f356a547bbb..73833e82b03 100644 --- a/addons/web/i18n/web.pot +++ b/addons/web/i18n/web.pot @@ -2872,6 +2872,13 @@ msgstr "" msgid "Only you" msgstr "" +#. module: web +#. openerp-web +#: code:addons/web/static/src/xml/debug.xml:0 +#, python-format +msgid "Open Developer Tools" +msgstr "" + #. module: web #. openerp-web #: code:addons/web/static/src/xml/debug.xml:0 @@ -2925,6 +2932,13 @@ msgstr "" msgid "Open: " msgstr "" +#. module: web +#. openerp-web +#: code:addons/web/static/src/js/views/list/list_renderer.js:0 +#, python-format +msgid "Optional columns" +msgstr "" + #. module: web #. openerp-web #: code:addons/web/static/src/js/fields/basic_fields.js:0 diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js index b14684e4acd..4f1696b43ea 100644 --- a/addons/web/static/src/js/core/dom.js +++ b/addons/web/static/src/js/core/dom.js @@ -485,6 +485,9 @@ var dom = { if (options && options.prop) { $input.prop(options.prop); } + if (options && options.role) { + $input.attr('role', options.role); + } return $container.append($input, $label); }, /** diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 68b1c47974c..42ea7ebbfe8 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -998,6 +998,7 @@ var ListRenderer = BasicRenderer.extend({ 'data-toggle': "dropdown", 'data-display': "static", 'aria-expanded': false, + 'aria-label': _t('Optional columns'), }); $a.appendTo($optionalColumnsDropdown); @@ -1016,6 +1017,7 @@ var ListRenderer = BasicRenderer.extend({ (config.isDebug() ? (' (' + col.attrs.name + ')') : ''); var $checkbox = dom.renderCheckbox({ text: txt, + role: "menuitemcheckbox", prop: { name: col.attrs.name, checked: _.contains(self.optionalColumnsEnabled, col.attrs.name), diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 80a357c771c..9adb490cf21 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -824,7 +824,7 @@ -