Closed Bug 1981631 Opened 3 months ago Closed 3 months ago

Fix accessible/tests/mochitest/elm/test_HTMLSpec.html to work with ::details-content element

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

Right now, the mochitest accessible/tests/mochitest/elm/test_HTMLSpec.html fails if we enable the ::details-content pseudo-element (about:config pref layout.css.details-content.enabled), per bug 1941406 comment 20.

Sample failure log: https://treeherder.mozilla.org/logviewer?job_id=520594076&repo=autoland&lineNumber=2415

TEST-UNEXPECTED-FAIL | accessible/tests/mochitest/elm/test_HTMLSpec.html | Wrong value of property 'role' for ['slot node', address: [object HTMLSlotElement], role: text container, address: [xpconnect wrapped nsIAccessible]].got 'text container', expected 'paragraph'

I think the failure is just indicating that we're adding a layer of wrapper pseudo-elements in there, which gets categorized as "text container" (which seems reasonable I think? I don't know precisely what these roles represent).

The test is expecting "paragraph" because the <details> element here does actually have a p child in the DOM tree (and now that child is a child of a ::details-content box, in the layout tree).

The test passes if I adjust the expectation to expect the child to be "text container" and to expect it to have a child which is a paragraph; I suspect that's the right adjustment here.

Filing this bug on making that edit and for forcing on this pref for this test (so that it stays green regardless of layout.css.details-content.enabled pref default changes).

I tried adding this to doTest to force-enable the pref:

      await SpecialPowers.pushPrefEnv({"set": [
          ["layout.css.details-content.enabled", true],
      ]});

But that doesn't seem to happen in time, possibly because <details> is hardcoded in the HTML and is present before that pushPrefEnv gets a chance to complete.

So let's just set the pref in the manifest file. Most-likely this pref won't exist for too long anyway (and will be default-enabled quite soon), so there's no big need to worry too much about setting it just for this one test.

Also, force-enable support for that new wrapper-box in this mochitest's
directory, so that the test's results will remain consistent regardless of when
we toggle the pref default to true/false.

Pushed by dholbert@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4107487ff2e8 https://hg.mozilla.org/integration/autoland/rev/bdf22821795e Adjust an a11y mochitest to account for details/summary now having a ::details-content pseudo-element wrapper-box. r=Jamie
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
See Also: → 1982410
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: