Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor jumps to end of input field on up/down keys #45

Closed
andertun opened this issue Mar 18, 2017 · 12 comments
Closed

Cursor jumps to end of input field on up/down keys #45

andertun opened this issue Mar 18, 2017 · 12 comments

Comments

@andertun
Copy link

I don't know if this is a bug or I'm missing something. But I can't get the arrow keys up/down to work properly. When I select the minutes (mm) and press key up it jumps to the end of the input field (after increasing the minute-value by one). The cursor doesnt jump in your demo, it stays and I can increase a value multiple times.

This is what I do:

<input type="text"
    ng-model="thingy.timeModel"
    datetime="mm:ss">
@andertun
Copy link
Author

I made a plunker... but can't reproduce the issue. Do anyone have an idea what might be causing this (when used in a large app)?

@eight04
Copy link
Owner

eight04 commented Mar 18, 2017

Thanks for the plunker! Is there any other library interacting with <input> element?

@andertun
Copy link
Author

Yes probably. This is the dependancy list (removed as many as I could).

angular.module('app', [
    'ui.router',
    'ngStorage',
    'ngDialog',
    'ngAudio',
    'datetime',
    'plupload.directive',
    'toastr'
])

Will also look into the directives we wrote ourselves, and see if any of them interact with <input> elements.

@eight04
Copy link
Owner

eight04 commented Apr 2, 2017

I've increase the priority of the directive in v5.1.1. Try if it can fix your issue.

@andertun
Copy link
Author

andertun commented Apr 3, 2017

I still have the issue. I just replaced datetime.js - did you change anything in custom-input?

@eight04
Copy link
Owner

eight04 commented Apr 3, 2017

Nope. By increasing the priority, there is a chance to fix rendering issue (i.e. $render function is overwritten by other directives).

BTW, does it happen to the demo of custom-input too?
https://rawgit.com/eight04/custom-input/master/demo.html

@ghost
Copy link

ghost commented Apr 12, 2017

I have the exact same issue. Additionally this happens when i just fill in parts of the date with numbers eg. i'm in the (day) section and type "1" followed by "1". After the second "1" is typed the cursor jumps to the end.

@maximepvrt
Copy link

maximepvrt commented Apr 12, 2017

Me too :(
And I tested after updating your directive with the best priority of my application.

@maximepvrt
Copy link

I found the problem is when jquery is in our page: https://plnkr.co/edit/KhYvapIHBxX0nHRpwjmX?p=preview

@eight04
Copy link
Owner

eight04 commented Apr 14, 2017

The problem is that jQuery has different behavior with el.val(undefined). In jqLite, el.val() and el.val(undefined) both return text value, but jQuery returns an jQuery object with el.val(undefined). I'll fix it later.

https://github.com/eight04/angular-datetime/blob/master/lib/directive.js#L67

@eight04 eight04 mentioned this issue Apr 14, 2017
@eight04
Copy link
Owner

eight04 commented Apr 14, 2017

#48

Also, here is the plunker with it:
https://plnkr.co/edit/TbfZhkxYs0ZReazDzYyH?p=preview

@eight04
Copy link
Owner

eight04 commented Apr 16, 2017

Fixed in 5.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants