[FIX] web: allow standard shortcuts on firefox

when navigating with the keyboard, using the ALT key is the trigger
for most of the access keys. In Firefox on Linux, this prevents a number
of existing shortcuts (like ALT+Left arrow for browser back).

This fix allows browsers to execute those shortcuts.

Note: in Firefox on linux ALT+F E V S B T H are assigned to menus and
cannot be stopped, removing the keypress handler does not change
anything.
This commit is contained in:
Vincent Schippefilt
2018-04-25 09:11:45 +02:00
parent de72b13064
commit 549573e24c
@@ -26,7 +26,6 @@ odoo.define('web.KeyboardNavigationMixin', function (require) {
var KeyboardNavigationMixin = {
events: {
'keydown': '_onKeyDown',
'keypress': '_onKeyPress',
'keyup': '_onKeyUp',
},
@@ -177,21 +176,6 @@ odoo.define('web.KeyboardNavigationMixin', function (require) {
}
}
},
/**
* hides the shortcut overlays when key press event is triggered on the ALT key
*
* @private
* @param keyPressEvent {jQueryKeyboardEvent} the keyboard event triggered
* @return {undefined|false}
*/
_onKeyPress: function (keyPressEvent) {
if ((keyPressEvent.altKey || keyPressEvent.key === 'Alt') && !keyPressEvent.ctrlKey) {
if (keyPressEvent.preventDefault) keyPressEvent.preventDefault(); else keyPressEvent.returnValue = false;
if (keyPressEvent.stopPropagation) keyPressEvent.stopPropagation();
if (keyPressEvent.cancelBubble) keyPressEvent.cancelBubble = true;
return false;
}
},
/**
* hides the shortcut overlays when keyup event is triggered on the ALT key
*