Backspace key moves the input to the previous section

2 posts, 0 answers
  1. Andrei
    Andrei avatar
    4 posts
    Member since:
    Mar 2018

    Posted 04 Feb Link to this post

    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.

  2. Svetlin
    Admin
    Svetlin avatar
    391 posts

    Posted 06 Feb Link to this post

    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.
Back to Top