From ac3e0fcd32d66d6e0bacfabd2d224805d92dbfd1 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: [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#70390 X-original-commit: 620e4cc28cefed6f4a3b5ca89b11cc37222acfaf Signed-off-by: Nicolas Lempereur (nle) --- addons/web/i18n/web.pot | 14 ++++++++++++++ addons/web/static/src/js/core/dom.js | 3 +++ addons/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(-) (limited to 'addons/web') diff --git a/addons/web/i18n/web.pot b/addons/web/i18n/web.pot index 8586334aa9e..45a2f74099a 100644 --- a/addons/web/i18n/web.pot +++ b/addons/web/i18n/web.pot @@ -2883,6 +2883,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 @@ -2936,6 +2943,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 cda4e07e5b4..93fb8ea68d2 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -983,6 +983,7 @@ var ListRenderer = BasicRenderer.extend({ 'data-toggle': "dropdown", 'data-display': "static", 'aria-expanded': false, + 'aria-label': _t('Optional columns'), }); $a.appendTo($optionalColumnsDropdown); @@ -1001,6 +1002,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 36b63c852ad..e18890ac188 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -824,7 +824,7 @@ -