Skip to content

Commit ae6f5e6

Browse files
committed
[GLFW] Fix the bug that prevents any text on the site from being deleted
1 parent d810342 commit ae6f5e6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/library_glfw.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@ var LibraryGLFW = {
419419
// This logic comes directly from the sdl implementation. We cannot
420420
// call preventDefault on all keydown events otherwise onKeyPress will
421421
// not get called
422-
if (event.keyCode === 8 /* backspace */ || event.keyCode === 9 /* tab */) {
422+
// Prevent default backspace and tab behavior when the target
423+
// is not an input or textarea. Otherwise, no text in the site can be deleted.
424+
if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA" &&
425+
(event.keyCode === 8 /* backspace */ || event.keyCode === 9 /* tab */)) {
423426
event.preventDefault();
424427
}
425428
},

0 commit comments

Comments
 (0)