Search and Top Navigation
#9474 closed bug (duplicate)
Opened August 05, 2013 03:39AM UTC
Closed August 07, 2013 09:46PM UTC
Last modified August 07, 2013 10:06PM UTC
Datepicker Keyboard Shortcuts Navigate Incorrectly with Bounded Multi-Month Options Set
Reported by: | marc.thorson | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.datepicker | Version: | 1.10.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Version Tested: jQuery UI 1.10.3; OS Tested: Windows 7; Browsers Tested: IE, Firefox, Chrome (bug most likely impacts all browsers and platforms)
When defining a Datepicker object with multiple months (numberOfMonths > 1) and fixed bounds (minDate and maxDate are defined), the keyboard shortcuts navigate improperly when the focus goes into the second month displayed. A bug exists in the jQuery UI Datepicker codebase which causes the focus to incorrectly jump back into the first month upon the next keyboard command.
To re-create the issue, create a new two-month Datepicker object with minimum and maximum dates that define a 45-day window around the current/default date. For example, if today's date is August 4, a minimum date of August 1 and maximum date of September 15 would produce a Datepicker object with this issue. Once defined, use the keyboard commands (e.g. Ctrl+Right) to navigate forward through the calendar. When the focus gets to the second month displayed, the script incorrectly jumps back into the first month displayed, which mistakenly makes it impossible for a keyboard user to effectively choose any date outside of the first month.
Upon further inspection of the code, the following modification appears to resolve the issue:
/* Adjust one of the date sub-fields. */
_adjustInstDate: function(inst, offset, period) {
var year = inst.selectedYear + (period === "Y" ? offset : 0),
month = inst.selectedMonth + (period === "M" ? offset : 0),
day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
Detailed examples of the bug and fix suggestion are provided at the following URLs:
Bug Example: http://jsbin.com/edutah/6/
Fix: http://jsbin.com/edamig/1/
Fix Example: http://jsbin.com/emufuq/1/
Attachments (0)
Change History (2)
Changed August 07, 2013 09:46PM UTC by comment:1
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed August 07, 2013 10:06PM UTC by comment:2
Replying to [comment:1 tj.vantoll]:
You're welcome. Glad I could help. I enjoy making the web accessible for all! Feel free to let me know if you need any more assistance.
Duplicate of #7956.Hi marc.thorson,
This is a duplicate of #7956 but I'm going to move your comments and test cases over there as this is a lot better explanation of the problem. Thanks!