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(useMagicKeys): also clear 'current' on @focus|@blur #2515

Merged
merged 1 commit into from Dec 16, 2022

Conversation

hartmut-co-uk
Copy link
Contributor

@hartmut-co-uk hartmut-co-uk commented Dec 6, 2022

Description

On macos when some keys are pressed in combo(cmd+p) open a dialog and the keyup is not triggered and the current keep a wrong state.
This fix now also clears the current: Set<string> with the existing reset() function (added in prior #1755).

fixes #1350

Additional context

ref: #1755

Testing / Reproduction, see description of #1350...


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.

@hartmut-co-uk
Copy link
Contributor Author

Here's a demo of the current bug, recorded on https://vueuse.org/core/usemagickeys/#demo

If you leave the window though e.g.

  • meta+shift+c
  • meta+f (find on page)
  • meta+tab (switch OS windows)

And then come back to the page/tab (focus). The previous keys are still in place and stay there until the same keys are pressed again...

vueuse-useMagicKeys-bug

@Thinkro
Copy link

Thinkro commented Dec 15, 2022

Does this fix these issues?
#2298
#1312
#946
#915
#491

This has been referenced so many times now, and i see 2 pull requests trying to fix it, addition to this one.

@hartmut-co-uk
Copy link
Contributor Author

Hi, I've tested locally one of the issues mentioned with Meta key. This PR does not fix issues related to MacOS / Meta key as far as I can tell, e.g. I can still reproduce the issue mentioned here:

image

But it still fixes issues as described (#1350) regarding to window @focus/@blur.

@antfu antfu merged commit 21d24da into vueuse:main Dec 16, 2022
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.

useMagicKeys: Alt is left after switching windows using Alt + Tab
3 participants