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

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

Open
babaric-dev opened this issue Jul 29, 2023 · 0 comments
Open

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

babaric-dev opened this issue Jul 29, 2023 · 0 comments

Comments

@babaric-dev
Copy link

<!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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant