Bug 1871424 - Make input checkbox/radio in link element work again; r=vhilla,dom-core,smaug

The root cause of issue is that the link elements have not yet adopted the
activation behavior defined in the specification. The appropriate  behavior/model
for links is still under discussion, https://github.com/whatwg/html/issues/1576.
For now, we aim for making it consistent with other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D197393
This commit is contained in:
Edgar Chen
2024-01-30 09:24:45 +00:00
parent 58941538f9
commit da474ad32d
3 changed files with 124 additions and 20 deletions

View File

@@ -4023,14 +4023,27 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
break;
}
// Bug 1459231: Temporarily needed till links respect activation target
// Then also remove NS_OUTER_ACTIVATE_EVENT
if ((aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT) &&
(mType == FormControlType::InputReset ||
mType == FormControlType::InputSubmit ||
mType == FormControlType::InputImage) &&
mForm) {
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
// Bug 1459231: Temporarily needed till links respect activation target,
// then also remove NS_OUTER_ACTIVATE_EVENT. The appropriate
// behavior/model for links is still under discussion (see
// https://github.com/whatwg/html/issues/1576). For now, we aim for
// consistency with other browsers.
if (aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT) {
switch (mType) {
case FormControlType::InputReset:
case FormControlType::InputSubmit:
case FormControlType::InputImage:
if (mForm) {
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
}
break;
case FormControlType::InputCheckbox:
case FormControlType::InputRadio:
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
default:
break;
}
}
}
} // if