Make sure an event triggered by Enter key press on a link is treated as a keyboard event

pull/6748/head
Aleksander Machniak 6 years ago
parent 5fb8e8cb86
commit 2c38460b09

@ -279,16 +279,20 @@ cancel: function(evt)
},
/**
* Determine whether the given event was trigered from keyboard
* Determine whether the given event was triggered from keyboard
*/
is_keyboard: function(e)
{
if (!e)
return false;
// DOM3-compatible
// An event invoked by pressing Enter on a link will produce a 'click' event,
// so we have to extend the check, e.g. with use of e.clientX.
if (e.type)
return !!e.type.match(/^key/); // DOM3-compatible
return !!e.type.match(/^key/) || (e.type == 'click' && !e.clientX);
// Old browsers
return !e.pageX && (e.pageY || 0) <= 0 && !e.clientX && (e.clientY || 0) <= 0;
},

Loading…
Cancel
Save