JQuery UI datepicker - problem with IE when using year / month dropdowns

I recently ran into a problem in IE using the jQuery UI datepicker script:

  • Load the page using datepicker on it, specifying both the year and month drop-down list.

  • Pick a date (this works great for the first time).

  • Open the datepicker again, but this time when you click on one of the dropdown lists of the year / month, it appears briefly and then disappears, which requires a second click to make it look right.

I have a small test page (see below) and tested it with jQuery 1.4.4 and jQuery UI 1.8.10 (my production configuration) and jQuery 1.5.2 and jQuery UI 1.8.12 and were able to play it in both cases ( using IE9 as well as in IE6).

<head> <script type="text/javascript"> $(document).ready(function () { $("#testDate").datepicker({changeYear:true, changeMonth:true, constrainInput:true, buttonText:'Choose', showOn:'both', showButtonPanel:false, buttonImageOnly:true}); }); </script> </head> <body> <h2>Test</h2> <input type="text" id="testDate" /> </body> 

I am trying to debug a miniature script that I should see where this happens, but I lost a little ...

+6
source share
1 answer

If you look at a non-minified source here (1.8.12), this function:

 /* Restore input focus after not changing month/year. */ _clickMonthYear: function(id) { var target = $(id); var inst = this._getInst(target[0]); if (inst.input && inst._selectingMonthYear) { setTimeout(function() { inst.input.focus(); }, 0); } inst._selectingMonthYear = !inst._selectingMonthYear; }, 

Removing the call to setTimeout() stops the focus problem in IE6 for me. Not sure what the side effect might be. I selected a few dates with locally modified jquery-ui and it seems to still work fine in Chrome12 and IE6. Maybe one for the jquery-ui team?

Edit Error report found - it looks like it is planned for 1.8.3

+4
source

Source: https://habr.com/ru/post/886859/


All Articles