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

Allow custom event onkeydown handlers for all input components #1584

Open
standbych opened this issue Jul 9, 2024 · 2 comments
Open

Allow custom event onkeydown handlers for all input components #1584

standbych opened this issue Jul 9, 2024 · 2 comments

Comments

@standbych
Copy link

standbych commented Jul 9, 2024

Describe the bug
It's not possible to use any custom onkeydown handlers anymore, because of the @onkeydown:stopPropagation added for #1379.

To Reproduce
Steps to reproduce the behavior:

  1. Add a RadzenNumberic component
  2. Add @onkeydown event handler
  3. run and press any key in the component (the event handler does not get called)

Demo project: https://github.com/standbych/radzen-keypress

Expected behavior
It should be possible to add custom event handlers or at least make the behaviour configurable.

@standbych standbych changed the title Allow custom event handlers for onkeypress Allow custom event handlers for onkeydown Jul 9, 2024
@standbych standbych changed the title Allow custom event handlers for onkeydown Allow custom event onkeydown handlers for all input components Jul 9, 2024
@enchev
Copy link
Collaborator

enchev commented Jul 9, 2024

I don't think we should do that. If we allow keydown propagation the internal handling of keyboard events in complex nested components like DataGrid will become nightmare. Key events from the Numeric will clash with keyboard navigation in the DataGrid, etc. Maybe introducing separate KeyDown event for such components will be a better option, still I'm not sure why you need it.

@standbych
Copy link
Author

I'd like to have some custom event handling for some keys like "Enter", "Escape" to move forward or reset the value.
The behaviour has worked before, but now I'm stuck with version 4.23.9 - before the stopPropagation was set.
A separate KeyDown event is not that intuitive, but still better than nothing. Wouldn't it be possible to set a CascadingValue in the DataGrid to set the stopPropagation value in the input components? Or a simple parameter which disables the stopPropagation?
The event handling works great for e.g. TextBox, but not Numeric and others anymore...

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

2 participants