telerik / kendo-react

Issue tracker - KendoReact http://www.telerik.com/kendo-react-ui/
https://kendo-react-teal.vercel.app
Other
212 stars 36 forks source link

[Enhancement][ComboBox] Consider propagating all key events to parent elements #2391

Open kdikov82 opened 1 month ago

kdikov82 commented 1 month ago

I'm submitting a...

Current behavior

Due to the keyboard navigation within the ComboBox, we are internally calling preventDefault for specific keys (like Esc for example for no obvious reason), thus making it impossible to catch Esc key from a parent element if it is pressed when the ComboBox is focused.

Expected behavior

All keyDown events should propagate.

Minimal reproduction of the problem with instructions

Open the example: https://stackblitz.com/edit/react-xwcg92-hlurfm?file=app%2Fapp.tsx

In the console you can observe that pressing "Esc" within the "input" propagates the keyDown event, while doing the same when the ComboBox is focused will not fire the onKeyDown event.

Package versions: 8.1.1

Temporary workaround: https://stackblitz.com/edit/react-xwcg92-5mpnj6?file=app%2Fapp.tsx

We can do something similar to the workaround internally and fire the event from the wrapping element.

kdikov82 commented 1 month ago

Actually, we can add a property that enables the propagation of all key events, so that we can still keep the existing behavior by default.