Skip to content

Bug for whatInput.ask() when leaving browser window #130

@babaric-dev

Description

@babaric-dev
<!DOCTYPE html>
    <html>
        <head>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/what-input/5.2.12/what-input.min.js"></script>
            <title>Testing</title>
    </head>
    <body>
        <label for="textbox">Type here: </label>
        <input name="textbox" id="textbox">
        <p id="inputtype"></p>
        <script>
            const textbox = document.getElementById("textbox");
            const inputtype = document.getElementById("inputtype");
            textbox.addEventListener("input", () => {
                inputtype.innerText = "input: " + whatInput.ask();
            });
            textbox.addEventListener("blur", () => {
                inputtype.innerText = "blur: " + whatInput.ask();
            });
        </script>
    </body>
</html>

Paste the code above into a file and then open it in a browser.
Also open another window (doesn't matter what) side by side.
Focus to the textbox, type something and then unfocus the browser window.
It shows the blur event is triggered, which is indeed correct. But whatInput.ask() should return mouse instead of keyboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions