Opened 8 years ago

Last modified 5 years ago

#8121 open bug

Datepicker: Focusing multiple elements at the same time throws an error.

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

Description

Hello,

When I upgraded to the latest release 1.8.17 I have an error on submit button on line: https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L644

This error is prompt because $.datepicker._curInst is null. This value seems to be nulled by calling $.datepicker._curInst.dpDiv.stop(true, true); method from: https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L642

As a temporary solution I found to rewrite the line: https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L643 from:

if ( inst && $.datepicker._datepickerShowing ) {

into:

if ( $.datepicker._curInst&&inst && $.datepicker._datepickerShowing ) {

I didn't had time to debug more deep. Maybe this is not the right patch.

I use jQuery 1.7.2.pre where "this" is changed by this line: https://github.com/jquery/jquery/blob/master/src/queue.js#L116

Change History (10)

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

Component: ui.coreui.datepicker
Owner: set to tojocky
Status: newpending

Please provide a reduced test case showing the problem.

comment:2 Changed 8 years ago by tojocky

Status: pendingnew

I can't attach the source-code example

Last edited 8 years ago by tojocky (previous) (diff)

comment:4 Changed 8 years ago by Scott González

Status: newopen
Summary: $.datepicker._curInst have no property input in _showDatepicker methodDatepicker: Focusing multiple elements at the same time throws an error.

The error comes from focusing multiple datepicker fields in the same event loop. You should file a bug against that validation plugin.

comment:5 Changed 8 years ago by tojocky

Sorry, What did you mean by: "You should file a bug against that validation plugin."? My proposed patch work... but I'm not sure this is the correct patch. Awaiting for feedback.

I have no permission to attach any file here.

Last edited 8 years ago by tojocky (previous) (diff)

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

I mean that it is never correct to fire a focus events on multiple elements. The validation plugin that you're using is implemented poorly and should be fixed.

comment:7 Changed 8 years ago by tojocky

Could you explain more exactly where is the problem? The plugin works as expected focusing multiple elements in one trigger call.

comment:8 Changed 8 years ago by Scott González

It's not possible to actually focus multiple elements at the same time. The plugin should work differently.

I'm not saying that there's not a bug in datepicker (that's why the ticket is still open), what I'm saying is that there's also a design bug in the validation plugin you're using.

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

Milestone: 1.9.01.11.0

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

Milestone: 1.11.0none
Note: See TracTickets for help on using tickets.