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

Closed
opened 2026-01-29 17:53:17 +00:00 by claunia · 1 comment
Owner

Originally created by @ImJezze on GitHub (Sep 24, 2024).

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

  • OS: Windows 10/11
  • Browser:
    • MauiBlazorWebView for RadzenNumericMauiTest
    • Edge/Chrome for RadzenNumericWebTest
  • Version: Radzen 5.2.2

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

Originally created by @ImJezze on GitHub (Sep 24, 2024). **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](https://github.com/user-attachments/files/17114073/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](https://github.com/user-attachments/files/17114073/RadzenNumericTest.zip) **Expected behavior** You can tab out of the input field after you have pressed the up/down arrow key. **Desktop** - OS: Windows 10/11 - Browser: - MauiBlazorWebView for RadzenNumericMauiTest - Edge/Chrome for RadzenNumericWebTest - Version: Radzen 5.2.2 **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](https://github.com/user-attachments/assets/57ae7788-3064-4362-8f59-fd38b7fb4e97)
Author
Owner

@ImJezze commented on GitHub (Sep 24, 2024):

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

@ImJezze commented on GitHub (Sep 24, 2024): @enchev Thanks for the quick fix, but is the else-branch still necessary?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1407