Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#5816 closed bug (fixed)

mouseover event gets fired when the day of today = the set day of the calendar

Reported by: gaby Owned by:
Priority: major Milestone: 1.11.0
Component: ui.datepicker Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:


It seems that under the following conditions

  • moving from any month to the month of today
  • the day of the set date (selected) is the same as the today day

mouseover event gets fired on the today table cell.

To reproduce


<div id="datepicker"></div>


  $('.ui-datepicker-today').live('mouseenter', function(){alert('entered');});


Go to previous month

Change History (6)

comment:1 Changed 12 years ago by sirneb

this bug still exists in 1.8.6. I'm not too familiar with the jquery source but I've tracked it to line 7999:

		if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
			cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
		inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();  /* the line in question */
		var numMonths = this._getNumberOfMonths(inst);
		var cols = numMonths[1];
		var width = 17;
		inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');

From what I can tell, at least for my own project, there is no adverse effects from removing this line but I do not see any reason why you need mouseover event here at all. But this does cause an unplanned mouseover trigger when "today" is bound to an mouseover/mouseenter event.

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

Milestone: TBD1.11.0

comment:3 Changed 10 years ago by mikesherov

Status: newopen

Please present in latest: confirmed.

comment:4 Changed 10 years ago by rxaviers

Two things to notice:

(a) about the testcase

If we replace .live for .on, we don't get the alerts anymore. Is it a .live thing?

(b) about inst.dpDiv.find("." + this._dayOverClass + " a").mouseover();

The first commit that introduced the mouseover trigger was 3522a23 --- side note, the short form it has now was due to 74d195e. Apparently, it addressed 3647. Although, this specific change seemed only to be a handy (yet unfortunate) way to avoid repeating code.

The two lines ran by the trigger (in the previous days and still today) are [1] and [2] below. The 1 has no effect, since such element has no ".ui-state-hover" class on creation anyway. The 2 adds ".ui-state-hover" to the target selector. But it gets removed later.

1: $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 2: $(this).addClass("ui-state-hover");

Unless I'm also missing something, we could safely remove the mouseover trigger.

Last edited 10 years ago by rxaviers (previous) (diff)

comment:5 Changed 9 years ago by Rafael Xavier de Souza

Resolution: fixed
Status: openclosed

Datepicker: Remove unnecessary mouseover trigger

Fixes #5816 Closes gh-974

Changeset: f0b4967388a5f0d7eb14c4b124886a11f4aa7d9e

comment:6 Changed 9 years ago by TJ VanToll

Datepicker: Abstract mouseover logic to avoid explicit event trigger

The reliance on .mouseover() caused an issue in some circumstances (see #5816). The removal of .mouseover() broke keyboard navigation (see #10319).

Fixes #10319 Closes gh-1290

Changeset: c399f1f77a015d4f269e3bda98720ebea9bb0c7a

Note: See TracTickets for help on using tickets.