1
1
mirror of https://github.com/varkor/quiver.git synced 2024-09-17 17:09:31 +03:00

Prevent Backspace triggering browser history events

This commit is contained in:
varkor 2018-12-29 23:03:33 +00:00
parent 553ccff52e
commit a2a8181fe8

View File

@ -707,11 +707,14 @@ class UI {
});
// Handle global key presses (such as keyboard shortcuts).
document.addEventListener("keydown", event => {
document.addEventListener("keydown", (event) => {
switch (event.key) {
case "Backspace":
// Remove any selected cells.
if (!(document.activeElement instanceof HTMLInputElement)) {
// Prevent Backspace triggering browser history navigation.
event.preventDefault();
for (const cell of this.selection) {
// Remove this cell and its dependents from the quiver
// and then from the HTML.