Skip to main content

Search and Top Navigation

#9561 closed bug (notabug)

Opened September 18, 2013 07:20AM UTC

Closed September 18, 2013 12:04PM UTC

Last modified September 18, 2013 12:07PM UTC

Jquery UI datepicker not closing on escape key as you would expect

Reported by: ranjith19 Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

have a look at http://jsfiddle.net/SYwpy/189/ to get a sense of what I am talking about

Below is the code for your ref

$(document).ready(function() {
    $('#input').datepicker({
    });
});
<input id="input">
<div id="output"></div>

1. Click on the text box

2. Hit escape.

3. Go away from the browser window or tab.

4. Then come back

5. Datetpicker is still there

I guess the browser fires a fucus event again when you get back to the window. Is it something wrong with Jquery date picker or something wrong with the browser?

There is another related problem

Also another related problem gets solved which is

1. Click on the input

2. Hit escape

3. Repeatedly clicking the input field will not allow you to see datepicker again unless you click somewhere else and come back

This is because there is no focus event fired second time.

In any case what I have been doing to circumvent this is http://jsfiddle.net/SYwpy/190/


$(document).ready(function() {
    $('#input').datepicker({
        onClose: function(){$(this).blur()}
    });
});

This solves both the issues I have mentioned.

Attachments (0)
Change History (3)

Changed September 18, 2013 07:23AM UTC by ranjith19 comment:1

Though the fiddles I have mentioned are of a different jquery ui version, the bug still exists in 1.10.3

Updated fiddles http://jsfiddle.net/SYwpy/192/

http://jsfiddle.net/SYwpy/191/

Changed September 18, 2013 12:04PM UTC by scottgonzalez comment:2

resolution: → notabug
status: newclosed

There is no bug here. If there's a focus event, you get the datepicker; if there isn't, you don't.

Changed September 18, 2013 12:07PM UTC by tj.vantoll comment:3

The first half is normal browser behavior.

For the second half though (click after escape keypress), I'm not sure what the datepicker should do. Our rewrite DOES reopen the datepicker on a click after escape so the behavior will be changing.