Skip to content

[BUG][Web] Alt + Enter justPressed works as pressed #173

Description

@T1mL3arn
// Project.hx

function ready() {
    app.scenes.main = new MainScene();
    app.input.onKeyDown(this, altEnterBug);
}

function altEnterBug(key) {
    // check A + S
    // expected once, prints once
    if (app.input.scanPressed(KEY_A) && app.input.scanJustPressed(KEY_S))
        trace('FULLSCREEN!');

    // check RIGHT_ALT + ENTER
    // expected once, prints constantly
    if (app.input.scanPressed(RALT) && app.input.scanJustPressed(ENTER))
        trace('FTW?');
}

Tested with clay/web/debug

Despite ENTER is checking with scanJustPressed(), the message prints infinitely.

From google ai:

This issue happens because Windows OS handles Alt + Enter globally as a repeating system command, whereas other key combinations are treated as standard inputs.When you hold down a standard key combo (like Ctrl + F), your game engine intercepts the initial press. However, when you hold Alt + Enter, Windows fires continuous, rapid OS-level repeat events directly into the underlying Chromium architecture of Electron. Because web/Electron apps listen to these raw repeat triggers, your toggle code runs on every single repeat frame, causing the flickering loop.

OpenFl had this issue too.
https://community.openfl.org/t/alt-enter-shortcut-for-fullscreen-not-working-properly/8575
openfl/lime@4956adc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions