-
Notifications
You must be signed in to change notification settings - Fork 41
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
lil-gui retaining focus on Windows? #136
Comments
Hi there, So this is partially intended behavior. All controllers are supposed to stop the propagation of keypress events while they have focus: Lines 82 to 84 in ad90324
The point is to prevent someone from, say, triggering global WASD controls while typing in a text field. But I'm surprised to hear that the events are still being captured after clicking elsewhere (and only on Windows?) For the time being you could comment out those lines, but I recall there being some conversation around making this behavior optional. (#69) Thanks for flagging this. |
Hi, Many thanks for your reply. Your suggestion of commenting out those 2 line has resolved the issue for me, so that's great - thanks. |
...I understand the need for this behaviour in other circumstances so the idea of it being optional is a good one. If I get any other insights as to why it seems to be a problem (for me) on Windows only, I will post it here. My old Mac is running an old version of Safari, so maybe it's "special" in some way (maybe just too old to interpret those 2 lines as expected) Thanks again for your help. Cheers, |
edit: what is described below has been proven wrong, see #136 (comment) Just a comment to share that I'm experiencing the same issue. Removing focus when clicking on anything else than the currently focused element fix that.
But ideally these two lines shouldn't be used outside of gui elements that requires keyboard interaction.
Hopes this helps, thank you for this lib! |
Thanks for your comment @AlaricBaraou. I think a future version of lil-gui will likely include some flag like I'm not able to reproduce the following however:
Clicking elsewhere when a form element is focused should cause that element to blur automatically. Testing here: https://lil-gui.georgealways.com/examples/basic But yes, I think the issue has come up enough that there should be a flag. |
@georgealways Apologies, it looks like you're right. I found the cause in my test environment, one of my other lib had a preventDefault() on the event where I was clicking, which would prevent the blur from happening. I withdraw what I said. Sorry for the misinformation. |
Hi,
My main js module has the following:
window.addEventListenter('keydown', onKeyDown, false);
I have noticed that after either:
*entering a value into text field
...this event no longer fires; I have to do some other interaction in my webpage (e.g. showing / hiding an item such as my custom tree-view) before it once again will detect a
keydown
event.It seems as though lil-gui retains focus even after clicking back onto the webpage. For example, if I:
...then any key I press (which I would expect to be handled by
onKeyDown()
) actually appears in the lil-gui text input fieldThe issue is occurring on Windows 10 version 22H2 (we use at work), though my home version (on Mac High Sierra!) does not have this problem.
Regards
The text was updated successfully, but these errors were encountered: