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

the callback is not executed when scope is' all ' #434

Open
genguxuanyin opened this issue Jul 4, 2023 · 12 comments
Open

the callback is not executed when scope is' all ' #434

genguxuanyin opened this issue Jul 4, 2023 · 12 comments

Comments

@genguxuanyin
Copy link

genguxuanyin commented Jul 4, 2023

image
Code update here, the key bind callback is not executed when scope is 'all'

@genguxuanyin
Copy link
Author

The latest version will appear, version 3.10.2 is normal

@jaywcjlove
Copy link
Owner

@genguxuanyin Please provide a reproducible example.

@jaywcjlove
Copy link
Owner

@genguxuanyin
Copy link
Author

genguxuanyin commented Jul 7, 2023

@jaywcjlove
https://codepen.io/genguxuanyin/pen/xxQXRXZ

When scope is "a", callbacks whose default scope is "all" should also be executed.
The version 3.10.4 will appear, version 3.10.2 is normal.

image

@jaywcjlove
Copy link
Owner

@genguxuanyin You set scope to a but you didn't define a keyboard shortcut for a.

https://codepen.io/jaywcjlove/pen/KKrXNRY?editors=1010

- hotkeys('delete, command+backspace, backspace', (keyboardEvent, hotkeysEvent) => {
+ hotkeys('delete, command+backspace, backspace', 'a', (keyboardEvent, hotkeysEvent) => {

@genguxuanyin
Copy link
Author

genguxuanyin commented Jul 7, 2023

@genguxuanyin You set scope to a but you didn't define a keyboard shortcut for a.

https://codepen.io/jaywcjlove/pen/KKrXNRY?editors=1010

- hotkeys('delete, command+backspace, backspace', (keyboardEvent, hotkeysEvent) => {
+ hotkeys('delete, command+backspace, backspace', 'a', (keyboardEvent, hotkeysEvent) => {

I want this shortcut to run on all scopes, but it can't run when I set scope to "a",Or this will not be executed.

-hotkeys('delete, command+backspace, backspace', (keyboardEvent, hotkeysEvent) => {
+hotkeys('delete, command+backspace, backspace', 'all', (keyboardEvent, hotkeysEvent) => {

https://codepen.io/genguxuanyin/pen/xxQXRXZ
When the version is 3.10.4, the callback is not executed when delete is pressed. When the version is 3.10.2, the callback is executed.

@jaywcjlove
Copy link
Owner

@genguxuanyin By default, scope is not given, and a value of all will be given globally. You changed the global value of scope to a, so it will not execute.

This behavior was fixed in #433, and if not fixed, would cause problems with executing callback methods multiple times.

@genguxuanyin
Copy link
Author

In versions 3.10.2, callbacks executed by all scopes could be written using scope= 'all', now how should I write them?

@jaywcjlove
Copy link
Owner

@genguxuanyin You need all scope + custom scope to monitor, right?

@qxang
Copy link

qxang commented Jul 10, 2023

@genguxuanyin hi, Have you solved this problem yet ?

@qxang
Copy link

qxang commented Jul 10, 2023

@genguxuanyin I have the same ; How to solve it ?

@jaywcjlove
Copy link
Owner

@genguxuanyin @qxang upgrade v3.11.2

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

No branches or pull requests

3 participants