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

Command (meta) modifier works incorrectly in Safari 6 #53

Closed
knyar opened this issue Aug 9, 2012 · 2 comments
Closed

Command (meta) modifier works incorrectly in Safari 6 #53

knyar opened this issue Aug 9, 2012 · 2 comments
Labels

Comments

@knyar
Copy link

knyar commented Aug 9, 2012

It looks like event bound to a key is also triggered if the key is pressed with a command modifier.
I am using the following test HTML file:

<html>
  <script src="mousetrap.js"></script>
  <script type="text/javascript">
    Mousetrap.bind('l', function() { console.log('l pressed'); });
  </script>
</html>

And I see the console message even when I hit "Command-l" rather than "l".

@ccampbell
Copy link
Owner

This is interesting. I can look more into it later, but in the mean time if you change it to a keydown event it should work as expected.

Mousetrap.bind('l', function() { console.log('l pressed'); }, 'keydown');

FireFox actually seems to behave the same way as Safari where as Chrome will not fire a keypress event if there is a meta modifier.

I will fix this in Mousetrap though to make it work as expected cross-browser so thanks for the report!

@jasonmoo
Copy link

I like your comment.

rr- pushed a commit to rr-/szurubooru that referenced this issue Oct 18, 2014
This removes need for my fix in keyboard.js: ccampbell/mousetrap#53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants