Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9561 closed bug (notabug)

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:


have a look at to get a sense of what I am talking about

Below is the code for your ref

$(document).ready(function() {
<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

$(document).ready(function() {
        onClose: function(){$(this).blur()}

This solves both the issues I have mentioned.

Change History (3)

comment:1 Changed 10 years ago by ranjith19

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

Updated fiddles

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

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.

comment:3 Changed 10 years ago by tj.vantoll

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.

Note: See TracTickets for help on using tickets.