Opened 6 years ago

Last modified 20 months ago

#9125 open bug

Datepicker reopens if focused after selecting a date in IE

Reported by: po_taka Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by Scott González)

Browsers affect: IE9

Datepicker appear immediately after date is selected

Change History (16)

comment:1 Changed 6 years ago by Scott González

Component: ui.datepickerui.dialog
Description: modified (diff)
Status: newopen
Summary: Dapicker not hidingDialog: Datepicker reopens after selecting a date inside a modal dialog in IE9

comment:2 Changed 6 years ago by tj.vantoll

The bug occurs in IE 7 - 10 and does not occur in Firefox/Chrome/Safari/Opera. Possibly related to #5419.

comment:3 Changed 6 years ago by tj.vantoll

Summary: Dialog: Datepicker reopens after selecting a date inside a modal dialog in IE9Dialog: Datepicker reopens after selecting a date inside a modal dialog in IE

comment:4 Changed 5 years ago by Jörn Zaefferer

In the datepicker rewrite we changed the datepicker to move the focus back to the text input after selecting a date. So the issue here, where focus ends up on the input again, wouldn't be an issue anymore, as it would happen consistently in all browsers, without reopening the datepicker.

Which doesn't explain this issue, but I feel like its not worth investing the time to find the source of the issue if it only occurs with the current datepicker. It would be different if it was reproducible with something else.

Last edited 5 years ago by Jörn Zaefferer (previous) (diff)

comment:5 Changed 5 years ago by peter.morlion

The issue, I believe is that focus is set on the first input. If this is a datepicker, it will open because the datepicker is set to open on focus. This is easily proven by comparing these two jsFiddles:

http://jsfiddle.net/aub9e/ - this one has an input before the datepicker. After selecting a date, you can see the focus is put on the first input.

http://jsfiddle.net/aub9e/1/ - here, the datepicker is the first input, so when it gets focus after selecting a date, the datepicker is reopened.

In Chrome, nothing gets focus after selecting a date, so no problem occurs. This can, however, be avoided by putting the autofocus on a certain other element (just adding 'autofocus' inside a tag, for example a button in the dialog).

comment:6 Changed 5 years ago by jasonaroo

Also occurs in IE10.

comment:7 Changed 5 years ago by po_taka

Bug still exist in v1.11.0

comment:8 Changed 5 years ago by ddelella

This bug still existing in v1.11.1 and is also a problem in IE11

comment:9 Changed 5 years ago by Scott González

#10613 is a duplicate of this ticket.

comment:10 Changed 5 years ago by Scott González

Component: ui.dialogui.datepicker
Summary: Dialog: Datepicker reopens after selecting a date inside a modal dialog in IEDatepicker reopens if focused after selecting a date in IE

comment:11 Changed 5 years ago by Scott González

#10612 is a duplicate of this ticket.

comment:12 Changed 5 years ago by Scott González

#9313 is a duplicate of this ticket.

comment:13 Changed 4 years ago by senyahnoj

Still an issue in 1.11.0 as demonstrated by the following fiddle:

http://jsfiddle.net/senyahnoj/4nhu9ss6/

Interestingly the same scenario in 1.9.1 posted by jasonaroo (comment 6) doesn't show this behaviour.

http://jsfiddle.net/aub9e/

I'm testing on IE11

comment:14 Changed 3 years ago by Deepak Shakya

I was able to fix this by setting the focus to the modal. Here is the jsFiddle from @scottgonzalez.

Here is the fix on jsFiddle.

$("#datepicker").datepicker({
    onSelect: function() {
        $("#dialog").focus();
    }
});
$("#dialog").dialog({
    modal: true
});

comment:15 Changed 3 years ago by Scott González

#14937 is a duplicate of this ticket.

comment:16 Changed 20 months ago by Marcus

I tried the focus fix, but it does not work for me. How to resolve this issue?

Note: See TracTickets for help on using tickets.