Ticket #5897 (closed bug: fixed)
Datepicker: inconsistent behavior in IE when click to close month and year drop-downs
| Reported by: | rdworth | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.8.4 |
| Component: | ui.datepicker | Version: | 1.8.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Using a datepicker with month and year drop-downs, if you click to expand a drop-down, then click in the same place to collapse it, the focus is set back to the instance element input. Except in IE. In IE, the focus stays on the drop-down.
Change History
comment:2 Changed 3 years ago by rdworth
- Summary changed from Datepicker: inconsistent behavior in IE when open and close month and year drop-downs without selecting to Datepicker: inconsistent behavior in IE when click to close month and year drop-downs
comment:3 Changed 3 years ago by rdworth
- Status changed from new to closed
- Resolution set to fixed
Fixed in 85b8816
comment:5 Changed 3 years ago by Richard D. Worth
Datepicker: use a setTimeout 0 so the same code can run in IE (as other browsers) to set focus back to the datepicker text input if a month or year drop-down is clicked closed. Fixes #5897 - Datepicker: inconsistent behavior in IE when click to close month and year drop-downs
Changeset: 85b8816fa9480005aedb3354714abbc1ead06897
Note: See
TracTickets for help on using
tickets.


There is a check to have this code not run in IE.
http://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L849
if (inst.input && inst._selectingMonthYear && !$.browser.msie) inst.input.focus();Testing shows this check is there because in IE the first click to expand the drop-down sometimes cause the drop-down to collapse immediately because focus goes from the drop-down to the text input. This can fixed by using a setTimeout 0 instead, so that IE can have the same behavior as other browsers.