Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent browser forward/backward navigation keys from crashing editor #1631

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ bitflags! {
const ALT = 0b_0000_0010;
const CONTROL = 0b_0000_0100;
const META_OR_COMMAND = 0b_0000_1000;
const BROWSER_BACK = 0b_0001_0000;
const BROWSER_FORWARD = 0b_0010_0000;
}
}

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/utility-functions/keyboard-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export function makeKeyboardModifiersBitfield(e: WheelEvent | PointerEvent | Mou
// Control (all platforms)
(Number(e.ctrlKey) << 2) |
// Meta (Windows/Linux) or Command (Mac)
(Number(e.metaKey) << 3)
(Number(e.metaKey) << 3) |
// Browser Back Button (Chrome)
(Number(e.getModifierState("BrowserBack")) << 4) |
// Browser Forward Button (Chrome)
(Number(e.getModifierState("BrowserForward")) << 5)
);
}

Expand Down