summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/misc.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-27 11:16:44 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-27 11:16:44 +0200
commita7a30791def5a033f5e77d42f155bafae0c430cb (patch)
treeba668f1a961ccd7455be33dfa50e0b763f7c360b /addons/web/static/src/js/core/misc.js
parent0da9da4c447eed7dafc10a17d59000a6cfa5f55f (diff)
parenta5187cef1078b01a27e05e761d7592b6857f41f9 (diff)
[MERGE] forward port branch saas-11.4 up to a5187cef107
Diffstat (limited to 'addons/web/static/src/js/core/misc.js')
-rw-r--r--addons/web/static/src/js/core/misc.js25
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);
}