Bug 1819769 - don't dispatch a11y related events when there are no listeners, r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D175016
This commit is contained in:
Olli Pettay
2023-04-11 09:24:21 +00:00
parent 51bb2095ca
commit b1764a8410
4 changed files with 32 additions and 2 deletions

View File

@@ -3728,8 +3728,10 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
#ifdef ACCESSIBILITY
// Fire an event to notify accessibility
if (mType == FormControlType::InputCheckbox) {
FireEventForAccessibility(this, eFormCheckboxStateChange);
} else {
if (nsContentUtils::MayHaveFormCheckboxStateChangeListeners()) {
FireEventForAccessibility(this, eFormCheckboxStateChange);
}
} else if (nsContentUtils::MayHaveFormRadioStateChangeListeners()) {
FireEventForAccessibility(this, eFormRadioStateChange);
// Fire event for the previous selected radio.
nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);