Skip to content

Commit 50773fe

Browse files
committed
Bug 1886268 - Add exceptions from a11y_checks for two clicks on non-interactive elements in Settings UI. r=settings-reviewers,Gijs
The `browser/browser/components/preferences/tests/browser_subdialogs.js` sends two clicks on the following non-interactive element to check the closing of the opened dialog using an alternative way of the popup dismissal is working as expected: 1. [label with "dialogTitle" class](https://searchfox.org/mozilla-central/rev/09b59a7de6848639f27297888889a06e97561074/browser/components/preferences/tests/browser_subdialogs.js#407-414) to confirm nothing happens 1. [overlay background with "dialogTemplate" ID](https://searchfox.org/mozilla-central/rev/09b59a7de6848639f27297888889a06e97561074/browser/components/preferences/tests/browser_subdialogs.js#416-435) to confirm clicking outside of the dialog does, in fact, closes it. For users of keyboards and assistive technology another way like pressing `Esc` key is available to dismiss the dialog, thus we need to add exceptions from the a11y_checks for this tests via `setEnv` and remove the `fail-if` notation from its test manifest. Differential Revision: https://phabricator.services.mozilla.com/D205120
1 parent fcda935 commit 50773fe

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

browser/components/preferences/tests/browser.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ support-files = [
276276
"subdialog.xhtml",
277277
"subdialog2.xhtml",
278278
]
279-
fail-if = ["a11y_checks"] # Bug 1854636 clicked label.dialogTitle, vbox#dialogTemplate.dialogOverlay may not be focusable
280279

281280
["browser_sync_chooseWhatToSync.js"]
282281

browser/components/preferences/tests/browser_subdialogs.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,29 @@ add_task(async function background_click_should_close_dialog() {
407407
// Clicking on an inactive part of dialog itself should not close the dialog.
408408
// Click the dialog title bar here to make sure nothing happens.
409409
info("clicking the dialog title bar");
410+
// We intentionally turn off this a11y check, because the following click
411+
// is purposefully targeting a non-interactive element to confirm the opened
412+
// dialog won't be dismissed. It is not meant to be interactive and is not
413+
// expected to be accessible, therefore this rule check shall be ignored by
414+
// a11y_checks suite.
415+
AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
410416
BrowserTestUtils.synthesizeMouseAtCenter(
411417
".dialogTitle",
412418
{},
413419
tab.linkedBrowser
414420
);
421+
AccessibilityUtils.resetEnv();
415422

416423
// Close the dialog by clicking on the overlay background. Simulate a click
417424
// at point (2,2) instead of (0,0) so we are sure we're clicking on the
418425
// overlay background instead of some boundary condition that a real user
419426
// would never click.
420427
info("clicking the overlay background");
428+
// We intentionally turn off this a11y check, because the following click
429+
// is purposefully targeting a non-interactive element to dismiss the opened
430+
// dialog with a mouse which can be done by assistive technology and keyboard
431+
// by pressing `Esc` key, this rule check shall be ignored by a11y_checks.
432+
AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
421433
await close_subdialog_and_test_generic_end_state(
422434
tab.linkedBrowser,
423435
function () {
@@ -432,6 +444,7 @@ add_task(async function background_click_should_close_dialog() {
432444
0,
433445
{ runClosingFnOutsideOfContentTask: true }
434446
);
447+
AccessibilityUtils.resetEnv();
435448
});
436449

437450
add_task(async function escape_should_close_dialog() {

0 commit comments

Comments
 (0)