Files
tubestation/accessible/tests/browser/tree/browser_searchbar.js
James Teh 8533e75f97 Bug 1938624 part 3: Map <input type="search"> and role="searchbox" to the new SEARCHBOX Gecko role. r=eeejay
1. Return this role as appropriate in HTMLTextFieldAccessible and update ARIAMap.
2. Remove Accessible::IsSearchbox, which is no longer required.
3. Remove Mac mozTextAccessible moxSubrole override. This was only used for password inputs and searchboxes, but we can now specify these subroles in the RoleMap instead.
4. Tweak the iOS code for the removal of IsSearchbox.

Differential Revision: https://phabricator.services.mozilla.com/D233230
2025-02-03 01:47:43 +00:00

91 lines
2.0 KiB
JavaScript

"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
const { CustomizableUITestUtils } = ChromeUtils.importESModule(
"resource://testing-common/CustomizableUITestUtils.sys.mjs"
);
let gCUITestUtils = new CustomizableUITestUtils(window);
// eslint-disable-next-line camelcase
add_task(async function test_searchbar_a11y_tree() {
let searchbar = await gCUITestUtils.addSearchBar();
// Make sure the popup has been rendered so it shows up in the a11y tree.
let popup = document.getElementById("PopupSearchAutoComplete");
let promise = Promise.all([
BrowserTestUtils.waitForEvent(popup, "popupshown", false),
waitForEvent(EVENT_SHOW, popup),
]);
searchbar.textbox.openPopup();
await promise;
let TREE = {
role: ROLE_EDITCOMBOBOX,
children: [
// image button toggling the results list
{
role: ROLE_BUTTONMENU,
children: [],
},
// input element
{
role: ROLE_SEARCHBOX,
children: [],
},
// context menu
{
role: ROLE_COMBOBOX_LIST,
children: [],
},
// result list
{
role: ROLE_GROUPING,
// not testing the structure inside the result list
},
],
};
testAccessibleTree(searchbar, TREE);
promise = Promise.all([
BrowserTestUtils.waitForEvent(popup, "popuphidden", false),
waitForEvent(EVENT_HIDE, popup),
]);
searchbar.textbox.closePopup();
await promise;
TREE = {
role: ROLE_EDITCOMBOBOX,
children: [
// image button toggling the results list
{
role: ROLE_BUTTONMENU,
children: [],
},
// input element
{
role: ROLE_SEARCHBOX,
children: [],
},
// context menu
{
role: ROLE_COMBOBOX_LIST,
children: [],
},
// the result list should be removed from the tree on popuphidden
],
};
testAccessibleTree(searchbar, TREE);
});