radzenhq / radzen-blazor

Radzen Blazor is a set of 90+ free native Blazor UI components packed with DataGrid, Scheduler, Charts and robust theming including Material design and FluentUI.
https://www.radzen.com
MIT License
3.5k stars 784 forks source link

RadzenNumeric prevents tab out when up/down key pressed before #1711

Closed ImJezze closed 2 weeks ago

ImJezze commented 2 weeks ago

Describe the bug When the input filed of RadzenNumeric has the focus you can increment/decrement the value via up/down key. After that you are not able to tab out of the field with the first tab press, only after the second tab press.

To Reproduce Steps to reproduce the behavior:

  1. Download RadzenNumericTest.zip
  2. Start RadzenNumericMauiTest or RadzenNumericWebTest app
  3. Click into first numeric input (labeled "Original RadzenNumeric")
  4. Press up key: value is incremented
  5. Press tab: nothing happens
  6. Press tab again: focus is changed to next element

Example Project RadzenNumericTest.zip

Expected behavior You can tab out of the input field after you have pressed the up/down arrow key.

Desktop

Additional context The problem is @onkeydown:preventDefault=preventKeyPress on the input element which is set to true after pressing the up/down key. It is set to false again when pressing another key, like the tab key. However, the first tap press is still swallowed and not propagated.

First I thought it's a MAUI issue because it does not happen on https://blazor.radzen.com/get-started, but it also doesn't work in the regular Blazor Web App implementation.

When I comment out line 509 in RadzenNumeric.razor.cs it works as expected. But I do understand, that it makes sense to prevent any other input while incrementing/decrementing the value. image

ImJezze commented 2 weeks ago

@enchev Thanks for the quick fix, but is the else-branch still necessary?