Ticket #5527 (closed bug: fixed)

Opened 4 years ago

Last modified 22 months ago

Datepicker: Problem selecting the date with keyboard shorcuts

Reported by: azran1981 Owned by:
Priority: minor Milestone: 1.8.7
Component: ui.datepicker Version: 1.8
Keywords: Cc:
Blocking: Blocked by:

Description

From  http://forum.jquery.com/topic/problem-selecting-the-date-with-keyboard-shorcuts

Open the datepicker. Then using crtl+arrow select the date and then press enter, the first time the date is selected, but if you repeat this process 3 or 4 times, the date selection fails and it keeps the old value. This always works using the mouse.

you can test it here  http://jqueryui.com/demos/datepicker/

I am using firefox and iexplorer 7,8

Change History

comment:1 Changed 4 years ago by nmb.ten

As of jQuery 1.4 the results from .add() will always be returned in document order (rather than a simple concatenation).  http://api.jquery.com/add/. Fix:  http://github.com/nmb10/jquery-ui/commit/3cc7a9c80aac6bbed447fa13dd4ced0c99a152ba

comment:2 Changed 4 years ago by DoctorArnar

Simple fix(I don't understand why we want to select the current, it's already selected. But I might be missing some logic so I keep it in there)

From this:

var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).add($('td.' + $.datepicker._currentClass, inst.dpDiv));
if (sel[0]){

To this:

var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv);
if(sel.length===0) sel = $('td.' + $.datepicker._currentClass, inst.dpDiv);
if(sel.length!==0){

Regarding nmb.ten commit: Might "if(sel.length!==0)" be better then "if(sel)"?!

comment:3 Changed 4 years ago by DoctorArnar

FYI: I feel that it should display the date picker on ctrl+down ( "home" is not used much ) also .attr('autocomplete','off') for the input element

comment:4 Changed 4 years ago by pheiberg

Committed  proposed solution to GitHub.

comment:5 Changed 4 years ago by pheiberg

  • Status changed from new to closed
  • Resolution set to fixed

Datepicker: made it possible to select a date in the selected month using enter. Fixes #5527 - Datepicker: Problem selecting the date with keyboard shorcuts

Changeset: 98f7e6a8d615772fbddbf185241d087a95e5e121

comment:6 Changed 4 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.7

comment:7 Changed 22 months ago by mikesherov

#5842 is a duplicate of this ticket.

comment:8 Changed 22 months ago by mikesherov

#6178 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.