keyboard event functionality
/****
*
*@purpose — Prepose for using this event here is that we can trigger keyboard event functionality in multiple location.
*
* **********/
document.addEventListener(‘keydown’, function (event) {
// arrow down
if (event.which === 40) {
}
// arrow up
if (event.which === 38) {
}
// enter
if (event.which === 13 && !event.ctrlKey && !event.metaKey) {
}
// escape
if (event.which === 27) {
}
// tab
if (event.which === 9) {
}
// ctrlKey + enter
if (event.which === 13 && event.ctrlKey) {
}
// ctrlKey + enter
if (event.which === 13 && event.metaKey) {
}
// shiftKey + enter
if (event.which === 13 && event.shiftKey) {
}
// shiftKey + enter
if (event.which === 13 && !event.shiftKey) {
}
});