parmarmayur9090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Ctrl-Down, Ctrl-Right navigation does not update the text of input control #222

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Go to datepicker control, datepicker opens a calendar. Select any date using 
Ctrl-Down or/and Ctrl-Right keys. Press enter. Date text does not change in 
input control.

What is the expected output? What do you see instead?
Date text should be changed on text selected in calendar. Instead of that it 
does not change.

Please provide a URL to a page displaying the problem.
http://jqueryui.com/demos/datepicker/default.html

What version of the datepicker are you using? On what operating system? And 
Which Browser?
IE 8, FF 3.6.6, Windows 7 64

Please provide any additional information below.

Original issue reported on code.google.com by DenisBon...@gmail.com on 5 Jul 2010 at 10:09

GoogleCodeExporter commented 8 years ago
Replication:
1. select a date (any method)
2. reopen the datepicker, use ctrl-arrow keys to select a different date. Note: 
the new date must be before the previously selected date. Press enter.

Expected output: field changes to new date.
Actual output: field does not change to new date.

Problem code:
...
_doKeyDown: function(event) {
...
case 13: var sel = $('td.' + $.datepicker._dayOverClass, 
inst.dpDiv).add($('td.' + $.datepicker._currentClass, inst.dpDiv));

Bug info:
The intended behaviour here when enter is pressed is to update the state and 
field with the newly selected date.

It builds an array, the first element is the dayOverClass, the newly selected 
date. The second element is the fallback, the previously selected date.

However, the method used to build this collection, the add() function, does not 
guarantee that new elements will be appended to the end of the collection. In 
fact, it uses DOM ordering. Therefore, if your newly selected date is after the 
old date, you're fine, but if it's before, the order of the collection is 
backwards and the code uses the wrong date.

Code fix: 
Replace:
case 13: var sel = $('td.' + $.datepicker._dayOverClass, 
inst.dpDiv).add($('td.' + $.datepicker._currentClass, inst.dpDiv));

With:
case 13: var sel = [$('td.' + $.datepicker._dayOverClass, inst.dpDiv), $('td.' 
+ $.datepicker._currentClass, inst.dpDiv)];

Original comment by mcn...@gmail.com on 7 Jul 2010 at 12:36

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/jquery-datepicker/wiki/NotTheUIDatePicker

Original comment by kelvin.l...@gmail.com on 11 Jul 2010 at 1:03