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

Backspace key moves the input to the previous section

1 Answer 727 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Andrei
Top achievements
Rank 1
Andrei asked on 04 Feb 2020, 11:49 AM

Hi.

I have such a problem: pressing the backspace key moves the input to the previous section. I.e. if a mistake is made in the year and hit backspace key, the cursor moves to the month part. How to fix it?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 06 Feb 2020, 09:30 AM

Hi Andrei,

Indeed, that is the default behavior of the input of the DatePicker and any other component that is a part of the DateInputs package. I can confirm that this implementation is by design. What could be done as a workaround is to use some custom JavaScript in order to handle the (keydown) event of the input element and to change the selection of the input element using its generic setSelectionRange() method. Please check such example implementation at the following link:

https://stackblitz.com/edit/angular-97uf5t-nq8em6?file=app/app.component.ts

I hope this helps, but I would like to point out that the suggested approach is not a supported built-in functionality provided by Kendo UI for Angular. Instead it relies on custom logic that may need some further adjustments in order to suite the use-case requirements. Furthermore, the example isn't fully tested and should be used at the developer's own discretion.

Please let me know in case I can provide any additional details on this or any other Kendo UI for Angular related topic. Thank you in advance.

Regards,
Svetlin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DatePicker
Asked by
Andrei
Top achievements
Rank 1
Answers by
Svet
Telerik team
Share this question
or