Improvements
Could i suggest the following improvements?
This ensures that the keyDown does not fire when the user is focused on input fields.
document.addEventListener("keypress", function(event) {
if (event.key === H && event.target.nodeName.toLowerCase() !== 'input' ) {
if (getDisplay(navBarSelector) === NONE) {
console.log('showing navbar')
showNavbars();
} else {
console.log('hiding navbar')
hideNavbars();
}
}
});
Improvements
Could i suggest the following improvements?
This ensures that the
keyDowndoes not fire when the user is focused on input fields.