diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-08-27 16:44:17 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-08-27 16:44:17 +0200 |
| commit | 9947133361f4d6fc4c9cbb68e2e2230728fcdafd (patch) | |
| tree | 4fc266cd52f55d94f86d7df2ab75323e35fde99c /addons/web/static/src/js/core/misc.js | |
| parent | f7ead5fd50f4b6db2a1d4c947fc4e15dceedbbd7 (diff) | |
| parent | 40430699dfbba715b143c109ebae415074da9f40 (diff) | |
[MERGE] forward port branch saas-11.5 up to 40430699dfb
Diffstat (limited to 'addons/web/static/src/js/core/misc.js')
| -rw-r--r-- | addons/web/static/src/js/core/misc.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/misc.js b/addons/web/static/src/js/core/misc.js index be0f012752c..cd9a73ef22b 100644 --- a/addons/web/static/src/js/core/misc.js +++ b/addons/web/static/src/js/core/misc.js @@ -52,6 +52,29 @@ if ($.blockUI) { } +/** + * Remove the "accesskey" attributes to avoid the use of the access keys + * while the blockUI is enable. + */ + +function blockAccessKeys() { + var elementWithAccessKey = []; + elementWithAccessKey = document.querySelectorAll('[accesskey]'); + _.each(elementWithAccessKey, function (elem) { + elem.setAttribute("data-accesskey",elem.getAttribute('accesskey')); + elem.removeAttribute('accesskey'); + }); +} + +function unblockAccessKeys() { + var elementWithDataAccessKey = []; + elementWithDataAccessKey = document.querySelectorAll('[data-accesskey]'); + _.each(elementWithDataAccessKey, function (elem) { + elem.setAttribute('accesskey', elem.getAttribute('data-accesskey')); + elem.removeAttribute('data-accesskey'); + }); +} + var throbbers = []; function blockUI() { @@ -60,6 +83,7 @@ function blockUI() { throbbers.push(throbber); throbber.appendTo($(".oe_blockui_spin_container")); $(document.body).addClass('o_ui_blocked'); + blockAccessKeys(); return tmp; } @@ -67,6 +91,7 @@ function unblockUI() { _.invoke(throbbers, 'destroy'); throbbers = []; $(document.body).removeClass('o_ui_blocked'); + unblockAccessKeys(); return $.unblockUI.apply($, arguments); } |
