Bug 1738070: Don't fire state change a11y events for NS_EVENT_STATE_DEFAULT changes on things other than buttons. r=morgan

We only expose this state on HTMLButtonAccessible, but we sometimes get these notifications for other controls; e.g. checkbox inputs.
We shouldn't fire a state change event for a state we never expose.

Differential Revision: https://phabricator.services.mozilla.com/D129673
This commit is contained in:
James Teh 2021-11-02 23:51:12 +00:00
Родитель 9c788583c9
Коммит 9e4079f57f
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -880,7 +880,9 @@ void DocAccessible::ContentStateChanged(dom::Document* aDocument,
FireDelayedEvent(event);
}
if (aStateMask.HasState(NS_EVENT_STATE_DEFAULT)) {
// We only expose NS_EVENT_STATE_DEFAULT on buttons, but we can get
// notifications for other controls like checkboxes.
if (aStateMask.HasState(NS_EVENT_STATE_DEFAULT) && accessible->IsButton()) {
RefPtr<AccEvent> event =
new AccStateChangeEvent(accessible, states::DEFAULT);
FireDelayedEvent(event);