-
Notifications
You must be signed in to change notification settings - Fork 160
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
Child handler doesn't stopPropagation since 1.1.4 release #106
Comments
Hello Colmea, thank you for your patience on this. Can you please confirm the latest version of the package that still works for you? The |
Are you are to provide any more specifics on this, Colmea? |
I'm seeing this as well, anyone have a workaround? I can submit a PR, is this still maintained? I love the API but afraid this has been open so long it's a dead project. |
Hey @greena13 , sorry for the delay. |
This will be resolved in v2.0.0-pre1 when it's released soon. |
Hello,
First thank you for your package.
Since the 1.1.4 release, and especially this Pull Request (https://github.com/greena13/react-hotkeys/pull/101/files), there is a breaking change regarding event propagation to parent's handler.
Before this release, a hotkey defined in a child component AND in a root component was only triggered once (by the most nested component). But now, they are always both triggered (nested component AND root component).
I guess this happens because we create a new handler on each render() (and so
hasChanged(handlers, prevHandlers)
is always true) (see: https://github.com/greena13/react-hotkeys/pull/101/files#diff-5f147d6760a1bc2314f409768a38984fR247).It means that your example in the README won't stop propagation to parent because a new handler is created on each render:
Is it a (new) expected behavior ? If its is, shouldn't we mark this PR as a breaking change ?
We had to rollback to previous release to fix this issue, and I guess we're not the only one to create a new handler on each render (bad idea though, but a breaking change nevertheless)
The text was updated successfully, but these errors were encountered: