Backed out changeset 972f3d069f80 (bug 1894437) for causing multiple mochitest failures CLOSED TREE

This commit is contained in:
Alexandru Marc
2025-03-15 03:32:35 +02:00
parent 18f8d3599d
commit e1e7965a9c
3 changed files with 1 additions and 67 deletions

View File

@@ -13,7 +13,6 @@
#include "mozilla/a11y/HyperTextAccessibleBase.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/Components.h"
#include "mozilla/ProfilerMarkers.h"
#include "nsIStringBundle.h"
#ifdef A11Y_LOG
@@ -679,21 +678,7 @@ void Accessible::ApplyImplicitState(uint64_t& aState) const {
}
} else if (aState & states::FOCUSED) {
Accessible* container = nsAccUtils::GetSelectableContainer(this, aState);
AUTO_PROFILER_MARKER_TEXT(
"Accessible::ApplyImplicitState::ImplicitSelection", A11Y, {}, ""_ns);
auto HasExplicitSelection = [](Accessible* aAcc) {
nsTArray<Accessible*> selectedItems;
aAcc->SelectedItems(&selectedItems);
for (Accessible* child : selectedItems) {
if (child->ARIASelected()) {
return true;
}
}
return false;
};
if (container && !(container->State() & states::MULTISELECTABLE) &&
!HasExplicitSelection(container)) {
if (container && !(container->State() & states::MULTISELECTABLE)) {
aState |= states::SELECTED;
}
}

View File

@@ -16,9 +16,6 @@ skip-if = ["verify"]
["browser_test_select_visibility.js"]
https_first_disabled = true
["browser_test_selection.js"]
https_first_disabled = true
["browser_test_visibility.js"]
https_first_disabled = true

View File

@@ -1,48 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Ensure explicit selection gets priority over implicit selection
addAccessibleTask(
`
<div role="listbox" id="listbox">
<div role="option" aria-selected="true" id="o1">a</div>
<div role="option" tabindex="0" id="o2">b</div>
</div>
`,
async function testExplicitSelection(browser, accDoc) {
const o1 = findAccessibleChildByID(accDoc, "o1");
const o2 = findAccessibleChildByID(accDoc, "o2");
await untilCacheOk(() => {
const [states] = getStates(o1);
return (states & STATE_SELECTED) != 0;
}, "option 1 should be selected");
await untilCacheOk(() => {
const [states] = getStates(o2);
return (states & STATE_SELECTED) == 0;
}, "option 2 should NOT be selected");
// Focus the second option.
const e = waitForEvents({
expected: [[EVENT_FOCUS, "o2"]],
unexpected: [[EVENT_SELECTION, "o2"]],
});
await invokeContentTask(browser, [], () => {
content.document.getElementById("o2").focus();
});
await e;
await untilCacheOk(() => {
const [states] = getStates(o1);
return (states & STATE_SELECTED) != 0;
}, "option 1 should be selected");
await untilCacheOk(() => {
const [states] = getStates(o2);
return (states & STATE_SELECTED) == 0 && (states & STATE_FOCUSED) != 0;
}, "option 2 should NOT be selected but should be focused");
},
{ chrome: true, iframe: true, remoteIframe: true }
);