Ticket #7359 (closed enhancement: wontfix)
Cannot detect mouse position over a disabled field in Firefox
| Reported by: | jason_lau@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.5 |
| Component: | event | Version: | 1.4.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Seems I can't detect the mouseX or mouseY while over a disabled form field. Works in IE, but not Firefox. Example
Change History
comment:2 follow-up: ↓ 3 Changed 3 years ago by snover
- Status changed from new to closed
- Resolution set to wontfix
Unfortunately, there really isn’t anything that jQuery can do about this. Not even using capturing works; both Firefox and WebKit just suck it into a big black hole of nothingness.
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 3 years ago by jason_lau@…
Replying to snover:
Unfortunately, there really isn’t anything that jQuery can do about this. Not even using capturing works; both Firefox and WebKit just suck it into a big black hole of nothingness.
I made a workaround that I think works in all browsers. If you would like to see - http://jsfiddle.net/Jason/Hg2SK/7/
comment:4 in reply to: ↑ 3 Changed 3 years ago by jitter
Replying to jason_lau@…:
I made a workaround that I think works in all browsers. If you would like to see - http://jsfiddle.net/Jason/Hg2SK/7/
Excatly what I was talking about. A similar thing was done by the developer of Firebug. This works for me in FF and Chrome.
comment:5 follow-up: ↓ 6 Changed 3 years ago by rwaldron
- Status changed from closed to reopened
- Type changed from bug to enhancement
- Component changed from unfiled to event
- Priority changed from undecided to low
- Keywords needsreview added
- Resolution wontfix deleted
I'm changing this to an "enhancement" that is up for review.
comment:6 in reply to: ↑ 5 Changed 3 years ago by jitter
Replying to rwaldron:
I'm changing this to an "enhancement" that is up for review.
Hmm, I don't think this should become an enhancement to the jQuery Core.
The proxy divs work well enough if you really need this. But I feel this to be too intrusive to include it in general. A jQuery plugin IMO is the right way to handle this.
Also this only works if you want to catch the event high up in the DOM tree (document, body, html). It doesn't solve the problem of binding an event directly to the disabled element e.g. $("input:disabled").bind("mousemove", function() { ... }) won't work. For this the proxy divs would need to trigger the event-handler bound to the disabled element.
comment:7 Changed 3 years ago by rwaldron
My reasoning is that jQuery does provide cross-browser normalization for unexpected incompatibilities. I think this particular one should at least be discussed - if it is dismissed outright, that is certainly fine as well.
comment:9 Changed 3 years ago by rwaldron
#7379 is More evidence to support the discussion of adding workaround support for this issue.
comment:10 Changed 3 years ago by jason_lau@…
comment:11 Changed 3 years ago by jason_lau@…
To eliminate cross-browser behavior inconsistencies, I added a client-side-generated transparent gif to the overlay. For example, Internet Explorer could not detect a click on a disabled field, but Firefox could. The transparent image (1px x 1px scaled to 100% x 100%) filled the void of the empty container, I suppose. It's been tested in all browsers. http://jasonlau.biz/jquery.detectmouseoverdisabled/
comment:12 Changed 3 years ago by dmethvin
- Keywords needsreview removed
- Status changed from reopened to closed
- Resolution set to wontfix
A plugin seems like a great way to fix this, thanks jason_lau!
comment:13 Changed 3 years ago by rwaldron
@dmethvin +1!
@jason_lau - how about putting your work up on github :D
comment:14 Changed 3 years ago by anonymous
@ rwaldron Done. Thanks for the suggestion. jasonlau at github.com
comment:15 Changed 3 years ago by jitter
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This isn't a jQuery bug IMO.
It works in IE and Opera but doesn't in Firefox and Chrome (so I guess it also won't work in Safari).
Without digging too deep I found this oooold bug report for FF. But from the looks of it this will never ever be fixed.
So it seems like you hit a specific behavior which varies between browsers. FF and Chrome don't accept/generate/pass-on any mouse-events when over a disabled element. While Opera and IE do.
In case you really depend on this specific code working crossbrowser:
This bug in FF also was a problem for the developer of Firebug (Firebug relies on mouse-events to know which element you want to inspect). They solved it by putting a proxy-div-overlays over the disabled elements. Firebug bug report and solution (css + js)
In case the original link becomes unavailable sometime I ported the test case to jsfiddle