Bug Tracker

Modify

Ticket #11382 (closed bug: fixed)

Opened 2 years ago

Last modified 22 months ago

Mouseenter doesn't fire on a disabled input element

Reported by: dmethvin Owned by: dmethvin
Priority: low Milestone: 1.8
Component: event Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

This was done intentionally in jQuery.event.dispatch based on #6911 to normalize a cross-browser behavior. However it seems inadvisable for us to do it, at least for some set of events. We can easily revert the change but it will cause other bug reports.

Test case:  http://jsfiddle.net/pm4JG/6/

Change History

comment:1 Changed 2 years ago by dmethvin

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to event
  • Milestone changed from None to 1.next

comment:2 Changed 2 years ago by dmethvin

I am thinking we may want to ban only click events with the idea that those are the most common events that should not appear on a disabled elements. The browser should never generate focus or blur on a disabled element so we shouldn't need to worry about them. Custom events or ones like mouseover would still occur, as would a program-created focus event because heaven forbid we should ever fail to fire a focus handler for an element that can't possibly receive focus.

comment:3 Changed 2 years ago by mikelehen@…

Relatedly (I assume), this breaks mouseenter / mouseleave event delegation. I'm trying to handle them on the *parent* of a disabled input control, but they don't always fire. This seems like a definite bug. Repros in Chrome and Firefox.

 http://jsfiddle.net/u5HqK/2/

comment:4 Changed 2 years ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned
  • Milestone changed from 1.next to 1.8

comment:5 Changed 2 years ago by jmarston

Firefox and Chrome don't appear to raise any mouse events for disabled inputs or buttons. Which means only banning click events would reintroduce inconsistencies between browsers for events like mouseover

comment:6 Changed 2 years ago by dmethvin

#11793 is a duplicate of this ticket.

comment:7 Changed 22 months ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

Fix #11382. #11764. Only prevent click events on disabled elements.

We don't want a disabled link/button to register delegated clicks, but we do want events like mouseover or custom events.

This is a compromise, there is no perfect solution. Well, the browsers could be consistent about direct vs. delegated events but *that's* not gonna happen.

Changeset: 8a01c9201abb3a5311d5b0019b0322de89df6374

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.