combokeys
Version:
Handles keyboard shortcuts in the browser
22 lines (18 loc) • 574 B
JavaScript
/* eslint-env node, browser */
/**
* should we stop this event before firing off callbacks
*
* @param {Event} e
* @param {Element} element
* @return {boolean}
*/
module.exports = function (e, element) {
// if the element has the class "combokeys" then no need to stop
if ((' ' + element.className + ' ').indexOf(' combokeys ') > -1) {
return false
}
var tagName = element.tagName.toLowerCase()
// stop for input, select, and textarea
return tagName === 'input' || tagName === 'select' || tagName === 'textarea' || element.isContentEditable
}