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

library_glfw.js blocks html inputs #22866

Open
uysalibov opened this issue Nov 6, 2024 · 2 comments
Open

library_glfw.js blocks html inputs #22866

uysalibov opened this issue Nov 6, 2024 · 2 comments

Comments

@uysalibov
Copy link

Why is the marked area in the link I gave in the glfw necessary? Although I do not use any key event in my own project, “backspace” and “tab” do not work in the inputs in html because of this marked field.

onKeydown: (event) => {
GLFW.onKeyChanged(event.keyCode, 1); // GLFW_PRESS or GLFW_REPEAT
// This logic comes directly from the sdl implementation. We cannot
// call preventDefault on all keydown events otherwise onKeyPress will
// not get called
if (event.keyCode === 8 /* backspace */ || event.keyCode === 9 /* tab */) {
event.preventDefault();
}
},

@sbc100
Copy link
Collaborator

sbc100 commented Nov 6, 2024

This doesn't answer your question but that code is duplicated from:

case 'keydown': case 'keyup': case 'keypress': case 'mousedown': case 'mouseup':
// If we preventDefault on keydown events, the subsequent keypress events
// won't fire. However, it's fine (and in some cases necessary) to
// preventDefault for keys that don't generate a character. Otherwise,
// preventDefault is the right thing to do in general.
if (event.type !== 'keydown' || (!SDL.unicode && !SDL.textInput) || (event.keyCode === 8 /* backspace */ || event.keyCode === 9 /* tab */)) {
event.preventDefault();
}

So I guess SDL programs have the same issue?

@uysalibov
Copy link
Author

Yes, probably it has same issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants