Commit d327be4
authored
Datepicker: Support init inside a delegated focus handler in jQuery 4
jQuery 4.0+ follows native focus events order, meaning that `focusin`
is fired after `focus`. As delegated `focus` is implemented in jQuery
via `focusin`, `focus` handlers attached during a delegated `focus`
handler will not fire until the second time the field receives focus.
This is what the `_attachments` method does. To account for that, show
the datepicker if input is already focused. `_showDatepicker` checks
if the datepicker is already open, so it's not a problem that it
fires again as a `focus` handler in jQuery <4.
Note that the fact such an initialization worked inside of delegated
focus handlers was a result of an implementation detail in jQuery. If
a regular `focus` handler was used to initialize the datepicker, neither
jQuery 4.0 nor 3.x would show the datepicker. This issue is now fixed
as well.
Fixes gh-2385
Closes gh-23901 parent f10169e commit d327be4
2 files changed
+60
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
543 | 579 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
238 | 254 | | |
239 | 255 | | |
240 | 256 | | |
| |||
594 | 610 | | |
595 | 611 | | |
596 | 612 | | |
| 613 | + | |
597 | 614 | | |
598 | 615 | | |
599 | 616 | | |
| |||
862 | 879 | | |
863 | 880 | | |
864 | 881 | | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
865 | 888 | | |
866 | 889 | | |
867 | 890 | | |
| |||
0 commit comments