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

fix(useKeyModifier): getModifierState is not a function #1441

Merged
merged 2 commits into from
Mar 26, 2022

Conversation

okxiaoliang4
Copy link
Member

Description

fixes: #1440

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@okxiaoliang4 okxiaoliang4 changed the title fix: getModifierState is not a function fix(useKeyModifier): getModifierState is not a function Mar 22, 2022
@antfu
Copy link
Member

antfu commented Mar 25, 2022

Not sure. I guess we could have an isSupported flag, instead of silently failing in production.

@okxiaoliang4
Copy link
Member Author

I'm guessing that the problem may also occur when non-keyboard or mouse events are passed in here.

@antfu
Copy link
Member

antfu commented Mar 25, 2022

Oh I see. I think instead we shouldn't listen to 'mousedown' and 'mouseup' since they have no effects anyway

@okxiaoliang4
Copy link
Member Author

Oh I see. I think instead we shouldn't listen to 'mousedown' and 'mouseup' since they have no effects anyway

For example, if you press ctrl when the browser is out of focus, the mousedown event can update the state when you click on the page

@antfu antfu merged commit 946f6bc into vueuse:main Mar 26, 2022
@okxiaoliang4 okxiaoliang4 deleted the hotfix/useKeyModifier branch March 26, 2022 18:29
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

Successfully merging this pull request may close these issues.

useKeyModifier: Uncaught TypeError: s.getModifierState is not a function
2 participants