How can I detect when a Mousetrap input is NOT being used?

141 Views Asked by At

I'm developing an app that uses text inputs.
I've added Mousetrap to my codebase to utilise shortcuts and it works as expected.

The issue I face: The regular keyup function also fires when the mouse trap function is called.

I would like to only fire the regular keyup function when a moustrap function isn't being used/called.

I've googled but perhaps am not wording it properly to get the desired help.

Regular keyup eventlistener"

    textAreaEl.addEventListener('keyup', function (e) {
            console.log('Regular keyup pressed')
    })

Mousetrap function:

    Mousetrap(textAreaEl).bind(['shift+enter'], function(e) {
        console.log('Shift+Enter pressed')
    })

Any help is much appreciated.

Thanks All.
Moe

0

There are 0 best solutions below