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

fix for html5 arrow keys not working on the console #3247

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

ninjamuffin99
Copy link
Member

@ninjamuffin99 ninjamuffin99 commented Aug 28, 2024

fixes #2190 and #3233

on HTML5, preventDefaultKeys in FlxKeyboard also calls preventDefault() to the keyboard event. This is helpful for not tabbing or scrolling the page when arrow keys or tab is pressed, but side effect is that it cancels the event propegation from reaching our event listeners fully.

This is a bit of a workaround for that, we directly call the event listener ourselves

@Geokureli
Copy link
Member

could we bypass preventDefualt if we add the listener to the stage rather then the input?

Since prevent default seems to be popping up a lot, should we consider some common back-end tool for "unprevented" key-events? (doesn't have to happen now)

@ninjamuffin99
Copy link
Member Author

I believe not, that snippet you highlighted attempts to focus the console if TAB is pressed, but even if it's added to the stage the event listener doesn't follow through.

disclaimer: may perhaps work with arrow keys, I just know tab has some special preventDefault() functionality in lime i thinky

@Geokureli
Copy link
Member

Sorry for the delay, I wanted to test that LEFT and RIGHT didn't scroll the page horizontally when the console was selected, i.e.: bypass the intent of preventDefault entirely. This seems to work fine in my test (pw: flixel)

@Geokureli Geokureli merged commit 32d4c35 into dev Sep 3, 2024
21 checks passed
@Geokureli Geokureli deleted the html5-console-keys-fix branch September 3, 2024 17:17
charlesisfeline pushed a commit to VsFreyaDevs/flixel3 that referenced this pull request Oct 11, 2024
@Geokureli Geokureli added this to the 5.9.0 milestone Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HaxeFlixel not detecting arrow key presses
2 participants