This is a migrated thread and some comments may be shown as answers.

Tab Focus Behavior Not Consistent With Input

1 Answer 93 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Veteran
Iron
Iron
Alex asked on 23 Feb 2021, 04:50 PM

When tabbing into an input element that has a value, the entire value is selected. However, when tabbing into a NumericTextBox that has a value in it, the value is not selected and the cursor is placed in front of the value.

Go to https://stackblitz.com/edit/geamde?file=src/main.vue and enter values for all 3 fields, click the first field, then tab to the second and third field to see an example. This is an example from the NumericTextBox documentation.

How can I make the behavior of NumericTextBox consistent with the other input fields?

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar
Telerik team
answered on 26 Feb 2021, 09:56 AM

Hi Alex,

You can achieve the desired functionality by adding the following code in the mounted hook of your application.

mounted: function() { const ageInput = document.querySelectorAll('[name="age"]')[0]; ageInput.addEventListener("focus", function(e){ ageInput.select(); }) }

Here is a modified version of the StackBlitz project you sent me. This example implements the above code and demonstrates how the value of the NumericTextBox is selected when the component is focused. 

Let me know if you have any questions or need furhter assistance with the current ticket.

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
NumericTextBox
Asked by
Alex
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Petar
Telerik team
Share this question
or