Closed
Bug 1428838
Opened 8 years ago
Closed 3 years ago
Click on link in disabled fieldset doesn't bubble click event up but does perform navigation default action
Categories
(Core :: DOM: UI Events & Focus Handling, enhancement, P3)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
DUPLICATE
of bug 1829874
People
(Reporter: bzbarsky, Unassigned)
References
Details
Testcase:
<body onclick="alert('hello'); return false">
<fieldset disabled>
<a href="http://example.com">Clicking this link should not navigate</a>
</fieldset>
</body>
This is related to bug 1220048, but this is not a case of being inside a disabled form control like a button. The behavior here just looks broken to me.
Flags: needinfo?(bugs)
| Reporter | ||
Comment 1•8 years ago
|
||
In particular, HTMLFieldSetElement::GetEventTargetParent does:
aVisitor.mCanHandle = false;
if (IsDisabledForEvents(aVisitor.mEvent->mMessage)) {
return NS_OK;
}
which seems pretty odd to me for a fieldset...
Comment 2•8 years ago
|
||
To reinforce this, see my comment over here: https://bugzilla.mozilla.org/show_bug.cgi?id=218093#c48
It is based on a real life use case in a Rails app, appearing in both plain Javascript and JQuery.
Comment 3•8 years ago
|
||
Yeah, this is broken. The question is what the behavior should be.
| Reporter | ||
Comment 4•8 years ago
|
||
I think the event firing should just work normally in this case. <fieldset disabled> doesn't disable the fieldset itself in any way. It just disables all the form controls inside the fieldset (and not even all of those, per spec; the ones inside the <legend> shouldn't get disabled, but we prevent event propagation out of the legend of a disabled fieldset too!). Clicking on those controls will do whatever we normally do for disabled controls. Clicking on other elements will behave normally.
In practice, I propose removing HTMLFieldSetElement::GetEventTargetParent altogether and maybe making HTMLFieldSetElement::IsDisabledForEvents return false unconditionally.
Updated•7 years ago
|
Priority: -- → P3
| Assignee | ||
Updated•7 years ago
|
Component: Event Handling → User events and focus handling
Comment 5•5 years ago
|
||
I arrived here from https://github.com/facebook/react/issues/17909 - I ran into this issue when using React on Firefox, because React attaches all event listeners to the top of the DOM. This means that I can't use an onChange handler on the <input /> in this example when using React on Firefox, because the event will not bubble up:
<fieldset disabled>
<legend>
<input type="checkbox" />
</legend>
</fieldset>
The linked issue has been closed as they consider it a browser bug, but it looks like they didn't mention it here.
| Reporter | ||
Updated•5 years ago
|
Flags: needinfo?(bugs)
Updated•3 years ago
|
Severity: normal → S3
Updated•3 years ago
|
Updated•3 years ago
|
Flags: needinfo?(smaug)
You need to log in
before you can comment on or make changes to this bug.
Description
•