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

Attach to "keydown" instead of "keyup" in "/src/utils/escape-key.js" #7335

Closed
tmcdos opened this issue Jul 1, 2020 · 3 comments
Closed

Attach to "keydown" instead of "keyup" in "/src/utils/escape-key.js" #7335

tmcdos opened this issue Jul 1, 2020 · 3 comments

Comments

@tmcdos
Copy link
Contributor

tmcdos commented Jul 1, 2020

Is your feature request related to a problem? Please describe.
I am facing the following situation (on Windows):

  • there is a QDialog open on the screen, and one of its QInput elements has the focus
  • I switch with Alt+Tab to another application (Total Commander)
  • I press F3 in Total Commander to see a text file in the built-in Lister
  • I press ESC in the Lister to close its window
  • apparently it reacts on WM_KEYDOWN Windows message and closes as soon as I press the ESC key
  • it happens so that the browser is the next application in the Alt+Tab circular queue, and as soon as the Lister closes its window the browser becomes the top-most application and thus receives the keyboard focus
  • all of the above happens so quickly that at the moment I release the ESC key the WM_KEYUP message from Windows is received from the browser and consequently by the handler in /src/utils/escape-key.js - and thus the QDialog is closed without my intention

Obviously this behavior is annoying.

Describe the solution you'd like
I have patched the Quasar source code (line 8 in /src/utils/escape-key.js) to listen for keydown event instead of keyup - it solves my case and hopefully does not break anyone else's case.

Describe alternatives you've considered
I am unable to come up with an alternative - this seems like the only possible solution.

Additional context
Screenshots will not help - but if requested, I can record a screencast (although it can not show the keyboard events and thus it seems not useful).

@pdanpdan
Copy link
Collaborator

pdanpdan commented Jul 2, 2020

Hello. Keydown instead of keyup would not be good because it would be a change from how it is now, unexpected and imposible to cancel. But I think checking if the keydown was caught before the keyup should be ok.

Please do a small test form me: replace in package.json "quasar": "^1...." with "quasar": "https://github.com/pdanpdan/quasar#quasar-v1.12.8-test.3-gitpkg" and report here if it fixes the problem.

Cleanup node_modules and yarn.lock / package-lock.json and do yarn/npm install.

@tmcdos
Copy link
Contributor Author

tmcdos commented Jul 3, 2020

Yes, your fix solves my issue. Thank you!

pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 5, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 7, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 7, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 9, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 9, 2020
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 9, 2020
@webnoob
Copy link
Contributor

webnoob commented Jul 10, 2020

Will be available in 1.12.9

@webnoob webnoob closed this as completed Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants