mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1520869 - Allow input/change events on disabled radio/checkboxes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D102517
This commit is contained in:
parent
2838080937
commit
4460528639
@ -2071,6 +2071,7 @@ bool nsGenericHTMLFormElement::IsElementDisabledForEvents(WidgetEvent* aEvent,
|
||||
case eAnimationEnd:
|
||||
case eAnimationIteration:
|
||||
case eAnimationCancel:
|
||||
case eFormChange:
|
||||
case eMouseMove:
|
||||
case eMouseOver:
|
||||
case eMouseOut:
|
||||
@ -2093,6 +2094,10 @@ bool nsGenericHTMLFormElement::IsElementDisabledForEvents(WidgetEvent* aEvent,
|
||||
break;
|
||||
}
|
||||
|
||||
if (aEvent->mSpecifiedEventType == nsGkAtoms::oninput) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME(emilio): This poking at the style of the frame is slightly bogus
|
||||
// unless we flush before every event, which we don't really want to do.
|
||||
if (aFrame && aFrame->StyleUI()->mUserInput == StyleUserInput::None) {
|
||||
|
@ -289,6 +289,23 @@ test(t => {
|
||||
assert_false(input.checked);
|
||||
}, `disabled radio should get legacy-canceled-activation behavior 2`);
|
||||
|
||||
for (const type of ["checkbox", "radio"]) {
|
||||
for (const handler of ["oninput", "onchange"]) {
|
||||
async_test(t => {
|
||||
const input = document.createElement("input");
|
||||
input.type = type;
|
||||
input.onclick = t.step_func(ev => {
|
||||
input.disabled = true;
|
||||
});
|
||||
input[handler] = t.step_func(ev => {
|
||||
assert_equals(input.checked, true);
|
||||
t.done();
|
||||
});
|
||||
input.click();
|
||||
}, `disabling ${type} in onclick listener shouldn't suppress ${handler}`);
|
||||
}
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
var form = document.createElement("form")
|
||||
var didSubmit = false
|
||||
|
Loading…
Reference in New Issue
Block a user