palantir/blueprint
View on GitHubuseHotkeys stopPropagation is called on the native event instead of the synthetic one
Open
#6028 opened on Mar 17, 2023
P2Package: coreType: bughelp wanted
Description
Environment
- Package version(s): 4.17.6
- Operating System: 13.2.1 (22D68)
- Browser name and version: Version 111.0.5563.64 (Official Build) (arm64)
Code Sandbox
Link to a minimal repro: https://codesandbox.io/s/serverless-rgb-cmsi5j
Steps to reproduce
- Focus the input group.
- Press
w. - Look at the console and notice how the parent component's
onKeyDownhandler is still called despite settingstopPropagation: trueon the hotkey.
Actual behavior
The parent onKeyDown handler was called.
Expected behavior
The parent onKeyDown handler shouldn't have been called.
Possible solution
stopPropagation should be called on React's synthetic event instead of the browser's native one because React uses event delegation and registers all handlers on the root node. Issue can be found here.