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

ctrl+tab doesn't fire #507

Open
donnydarko opened this issue Jun 28, 2021 · 1 comment
Open

ctrl+tab doesn't fire #507

donnydarko opened this issue Jun 28, 2021 · 1 comment

Comments

@donnydarko
Copy link

donnydarko commented Jun 28, 2021

I want to use ctrl+tab in my electronjs app. So it is not a browser to interrupt with tab changing shortcut. However when I'm inside a text area it doesn't fire at all. Other shortcuts without tab do. How do I bind the whole document ?

<script>
    Mousetrap.bind(['command+tab', 'ctrl+tab'], function() {
       alert('command tab or control tab);

        // return false to prevent default browser behavior
        // and stop event from bubbling
        return false;
    });
</script>
@j-applese3d
Copy link

From the documentation:

Text fields

By default all keyboard events will not fire if you are inside of a textarea, input, or select to prevent undesirable things from happening.

If you want them to fire you can add the class mousetrap to the element.

<textarea name="message" class="mousetrap"></textarea>

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

2 participants