An open source design system that's fully customizable and agent ready
TypeScript
test(a11y): the release contract run gives one result on every machine (#7590)
Cindy Zhangba59d5c99903
diff --git a/internal/a11y-spec/src/harness/chromium.ts b/internal/a11y-spec/src/harness/chromium.tsindex 08537c9283..dd28fee813 100644--- a/internal/a11y-spec/src/harness/chromium.ts+++ b/internal/a11y-spec/src/harness/chromium.ts@@ -314,6 +314,13 @@ async function computedNode(}}+/**+ * How long `abortedPress` holds the press before sliding off: past the+ * longest press-timing delay a component uses (DropdownMenu's 300 ms settle+ * delay, the 500 ms long press).+ */+const ABORTED_PRESS_HOLD_MS = 700;+/*** Stop transitions before an expectation reads state, so nothing measures a* frame the animation happens to be showing.@@ -1186,6 +1193,13 @@ export function createChromiumHarness(}await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);await page.mouse.down();+ // Hold the press before sliding off, as a person who changes their mind+ // does. A press released at once has a duration set by the machine: a+ // component that times the press (DropdownMenu ignores the release of an+ // opening press shorter than its settle delay) then reports a different+ // outcome on a loaded runner than on an idle one. Holding past any such+ // delay gives every machine the same gesture.+ await page.waitForTimeout(ABORTED_PRESS_HOLD_MS);await page.mouse.move(releaseX, releaseY);await page.mouse.up();},diff --git a/packages/core/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.ts b/packages/core/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.tsindex a6b6deb428..eb9b88f920 100644--- a/packages/core/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.ts+++ b/packages/core/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.ts@@ -2,53 +2,11 @@/*** @file MenuButton.a11y.known-failures.ts- * @input The exact menu-button contract failures the shipped triggers produce today+ * @input Uses KnownFailure from @astryxdesign/a11y-spec* @output MENU_BUTTON_KNOWN_FAILURES — records both lanes reconcile against, so a fix shows up as an unexpected pass and any other failure stays a failure* @position Known-failure ledger for the DropdownMenu/MoreMenu menu-button binding*/import type {KnownFailure} from '@astryxdesign/a11y-spec';-const ABORTED_PRESS_STANDARD =- 'WCAG 2.2 2.5.2 Pointer Cancellation — a single-pointer function does not complete on the down-event unless the up-event reverses it or it can be aborted';-const ABORTED_PRESS_REASON =- "The anchored trigger opens on press-down by module:DropdownMenu/useMenuPress FR8 and DEC-4, which are still proposed (that record's OQ1). This test-only binding records the shipped behavior; the press model's owner decision either makes it conformant or brings the fix.";--export const MENU_BUTTON_KNOWN_FAILURES: ReadonlyArray<KnownFailure> = [- {- expectation: 'menu-button.control.survives-an-aborted-press',- binding: 'DropdownMenu.trigger',- state: 'dropdown-button-closed',- evidenceLayer: 'real-browser',- failureEquals:- 'releasing the press away from the control left aria-expanded true instead of false',- standardsReference: ABORTED_PRESS_STANDARD,- userImpact:- 'A mouse user who presses the Actions button and slides off before releasing, to cancel, still gets the menu: it opens on press-down and stays open.',- reason: ABORTED_PRESS_REASON,- },- {- expectation: 'menu-button.control.survives-an-aborted-press',- binding: 'DropdownMenu.trigger',- state: 'dropdown-render-trigger-closed',- evidenceLayer: 'real-browser',- failureEquals:- 'releasing the press away from the control left aria-expanded true instead of false',- standardsReference: ABORTED_PRESS_STANDARD,- userImpact:- 'A mouse user who presses a caller-rendered trigger and slides off before releasing, to cancel, still gets the menu: it opens on press-down and stays open.',- reason: ABORTED_PRESS_REASON,- },- {- expectation: 'menu-button.control.survives-an-aborted-press',- binding: 'DropdownMenu.trigger',- state: 'more-menu-closed',- evidenceLayer: 'real-browser',- failureEquals:- 'releasing the press away from the control left aria-expanded true instead of false',- standardsReference: ABORTED_PRESS_STANDARD,- userImpact:- 'A mouse user who presses the MoreMenu button and slides off before releasing, to cancel, still gets the menu: it opens on press-down and stays open.',- reason: ABORTED_PRESS_REASON,- },-];+export const MENU_BUTTON_KNOWN_FAILURES: ReadonlyArray<KnownFailure> = [];diff --git a/packages/core/src/reset.a11y.chromium.spec.ts b/packages/core/src/reset.a11y.chromium.spec.tsindex 0f6bd01fc8..53daf87f6b 100644--- a/packages/core/src/reset.a11y.chromium.spec.ts+++ b/packages/core/src/reset.a11y.chromium.spec.ts@@ -72,7 +72,15 @@ test('Chromium keeps every selector the reset writes', async ({page}) => {// A forgiving list drops an invalid entry instead of the whole rule, so a// dropped pseudo-element shows up as a shorter serialized selector.const parsed = await page.evaluate(() => {- const layer = document.styleSheets[0].cssRules[0] as CSSLayerBlockRule;+ // The sheet opens with the `@layer` order statement; the rules live in+ // the `reset` layer block after it.+ const layer = [...document.styleSheets[0].cssRules].find(+ (rule): rule is CSSLayerBlockRule =>+ rule instanceof CSSLayerBlockRule && rule.name === 'reset',+ );+ if (layer == null) {+ throw new Error('reset.css has no @layer reset block');+ }return [...layer.cssRules].map(rule => (rule as CSSStyleRule).selectorText);});expect(parsed.map(normalize)).toEqual(