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:
parent
553ccff52e
commit
a2a8181fe8
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user