Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switch (e.keyCode) {
case code("K"):
if (e.currentTarget.previousSibling && e.currentTarget.previousSibling.previousSibling)
FocusManager.focusFirst(e.currentTarget.previousSibling.previousSibling);
break;
case code("J"):
if (e.currentTarget.nextSibling && e.currentTarget.nextSibling.nextSibling)
FocusManager.focusFirst(e.currentTarget.nextSibling.nextSibling);
break;
case KeyCode.left:
case code("H"):
case code("B"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.previousSibling && list.previousSibling.previousSibling)
FocusManager.focusFirst(list.previousSibling.previousSibling);
break;
case KeyCode.right:
case code("W"):
case code("L"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.nextSibling && list.nextSibling.nextSibling)
FocusManager.focusFirst(list.nextSibling.nextSibling);
break;
}
},
list;
switch (e.keyCode) {
case code("K"):
if (e.currentTarget.previousSibling)
FocusManager.focusFirst(e.currentTarget.previousSibling);
break;
case code("J"):
if (e.currentTarget.nextSibling)
FocusManager.focusFirst(e.currentTarget.nextSibling);
break;
case KeyCode.left:
case code("H"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.previousSibling) FocusManager.focusFirst(list.previousSibling);
break;
case KeyCode.right:
case code("L"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.nextSibling) FocusManager.focusFirst(list.nextSibling);
break;
}
},
break;
case code("J"):
if (e.currentTarget.nextSibling)
FocusManager.focusFirst(e.currentTarget.nextSibling);
break;
case KeyCode.left:
case code("H"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.previousSibling) FocusManager.focusFirst(list.previousSibling);
break;
case KeyCode.right:
case code("L"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.nextSibling) FocusManager.focusFirst(list.nextSibling);
break;
}
},
onTaskKeyDown(e, instance) {
let {store, data} = instance;
let t = data.task;
let {$task} = store.getData();
let code = c => c.charCodeAt(0);
switch (e.keyCode) {
case KeyCode.delete:
case code("D"):
if (e.keyCode === code("D") && !e.shiftKey) return;
let item = closest(e.target, el =>
el.classList.contains("cxe-menu-item")
);
let elementReceivingFocus = item.nextElementSibling || item.previousElementSibling;
batchUpdatesAndNotify(() => {
updateTask({
id: $task.id,
deleted: true,
deletedDate: new Date().toISOString()
});
}, () => {
if (elementReceivingFocus)
FocusManager.focusFirst(elementReceivingFocus);
});
break;
if (e.currentTarget.nextSibling && e.currentTarget.nextSibling.nextSibling)
FocusManager.focusFirst(e.currentTarget.nextSibling.nextSibling);
break;
case KeyCode.left:
case code("H"):
case code("B"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.previousSibling && list.previousSibling.previousSibling)
FocusManager.focusFirst(list.previousSibling.previousSibling);
break;
case KeyCode.right:
case code("W"):
case code("L"):
list = closest(e.target, el => el.classList.contains("cxb-tasklist"));
if (list.nextSibling && list.nextSibling.nextSibling)
FocusManager.focusFirst(list.nextSibling.nextSibling);
break;
}
},