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 console completion selection on HTML5 #3225

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions flixel/system/debug/completion/CompletionList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class CompletionList extends Sprite
createPopupEntries(capacity);
createScrollBar();
updateSelectedItem();

FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this wasn't working? Is this a preventDefault issue? or is the console blocking these events somehow?

Copy link
Member Author

@ninjamuffin99 ninjamuffin99 Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure, I believe it's not console or FlxG.stage specific, since Lib.current.addEventListener also doesn't register tab key, and also the autofocus event listener doesn't work either ("Press TAB to focus the console!") in HTML5. It could be a preventDefault thing!

}

public function show(x:Float, items:Array<String>)
Expand Down Expand Up @@ -82,7 +80,7 @@ class CompletionList extends Sprite
addChild(scrollBar);
}

function onKeyDown(e:KeyboardEvent)
public function onKeyDown(e:KeyboardEvent)
{
if (!visible)
return;
Expand Down
4 changes: 4 additions & 0 deletions flixel/system/debug/console/Console.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ class Console extends Window
function onKeyDown(e:KeyboardEvent)
{
if (completionList.visible)
{
// Fixes issue with listening for key down events - https://github.com/HaxeFlixel/flixel/pull/3225
completionList.onKeyDown(e);
Geokureli marked this conversation as resolved.
Show resolved Hide resolved
return;
}

switch (e.keyCode)
{
Expand Down
Loading