Fix keyboard event detection with jQuery 3.x and remove hacks for old browsers

This fixes e.g. unwanted focus on a toolbar button after closing popup
menu with mouse click on the document.
pull/5432/head
Aleksander Machniak 8 years ago
parent f92052fd73
commit bfbab5bcde

@ -1767,9 +1767,6 @@ function rcube_webmail()
var target = e.target || {},
keyCode = rcube_event.get_keycode(e);
// save global reference for keyboard detection on click events in IE
rcube_event._last_keyboard_event = e;
if (e.keyCode != 27 && (!this.menu_keyboard_active || target.nodeName == 'TEXTAREA' || target.nodeName == 'SELECT')) {
return true;
}

@ -280,11 +280,8 @@ cancel: function(evt)
is_keyboard: function(e)
{
return e && (
(e.pointerType !== undefined && e.pointerType !== 'mouse') || // IE 11+
(e.mozInputSource && e.mozInputSource == e.MOZ_SOURCE_KEYBOARD) || // Firefox
(e.offsetX === 0 && e.offsetY === 0) || // Opera
(!e.pageX && (e.pageY || 0) <= 0 && !e.clientX && (e.clientY || 0) <= 0) || // others
(bw.ie && rcube_event._last_keyboard_event && rcube_event._last_keyboard_event.target == e.target) // hack for IE <= 10
(e.type && String(e.type).match(/^key/)) // DOM3-compatible
|| (!e.pageX && (e.pageY || 0) <= 0 && !e.clientX && (e.clientY || 0) <= 0) // others
);
},

Loading…
Cancel
Save