From 9960e48e869728081af376d138fda30b227ba7e9 Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Fri, 21 Sep 2018 10:51:01 +0200 Subject: [PATCH] [FIX] web: on MAC, remove access keys activation interference On MAC, some characters can only be typed using the ALT+Number that was reserved for the menu access keys. There is a system in place to collect the ALT+Number keys and force the activation of the shortcut to make the experience better for all users across all machines. This fix remove this system that collects ALT+Number or other keys on MAC Ticket number : 1887171 --- .../web/static/src/js/chrome/keyboard_navigation_mixin.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js b/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js index 6fec5795bee..5a9576b39cc 100644 --- a/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js +++ b/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js @@ -141,6 +141,13 @@ odoo.define('web.KeyboardNavigationMixin', function (require) { }); this._addAccessKeyOverlays(); } + // on mac, there are a number of keys that are only accessible though the usage of + // the ALT key (like the @ sign in most keyboards) + // for them we do not facilitate the access keys, so they will need to be activated classically + // though Control + Alt + key (case sensitive), see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey + if (this.BrowserDetection.isOsMac()) + return; + if (keyDownEvent.altKey && !keyDownEvent.ctrlKey && keyDownEvent.key.length === 1) { // we don't want to catch the Alt key down, only the characters A to Z and number keys var elementWithAccessKey = []; if (keyDownEvent.keyCode >= 65 && keyDownEvent.keyCode <= 90 || keyDownEvent.keyCode >= 97 && keyDownEvent.keyCode <= 122) {