An open source design system that's fully customizable and agent ready
TypeScript
fix(a11y): read menu state after aborted press (#7112)
Cindy Zhang78db903adfc6
diff --git a/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.ts b/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.tsindex 6883467b1a..8b78bf2af1 100644--- a/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.ts+++ b/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.ts@@ -5,7 +5,8 @@* @input Uses the shared checkbox contract, Chromium harness, checked-in* CheckboxA11y stories, state inventory, and exact known failures* @output Real-browser and accessibility-tree evidence for every current- * checkbox-bearing Astryx component part.+ * checkbox-bearing Astryx component part, including state restored after a+ * menu's expected pointer dismissal.* @position Browser lane required by AST-013; it makes no real-AT claim.*/@@ -109,13 +110,29 @@ async function runState(knownFailures: CHECKBOX_KNOWN_FAILURES,mount: async () => {await mountState(page, state);- return createChromiumHarness({+ const harness = createChromiumHarness({page,subject: subjectFor(page, state),pointerTarget: pointerTargetFor(page, state),cdp,visibleLabel: visibleLabelFor(page, state),});+ if ((state as CheckboxBindingState).opensMenu !== true) {+ return harness;+ }+ return {+ ...harness,+ abortedPress: async subject => {+ await harness.abortedPress(subject);+ const item = subjectFor(page, state);+ await item.waitFor({state: 'hidden'});+ await page+ .locator('#storybook-root')+ .getByRole('button', {name: 'View options'})+ .click();+ await item.waitFor({state: 'visible'});+ },+ };},});}diff --git a/packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts b/packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.tsindex 7400160348..e5ab6a10a9 100644--- a/packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts+++ b/packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts@@ -3,7 +3,9 @@/*** @file RadioGroup.a11y.chromium.spec.ts* @input Uses the shared radio-group contract, Chromium harness, checked-in stories, inventory, and exact known failures- * @output Real-browser and accessibility-tree evidence for every current bound radio-group part+ * @output Real-browser and accessibility-tree evidence for every current bound+ * radio-group part, including state restored after a menu's expected pointer+ * dismissal* @position Browser lane required by AST-013; it makes no real-AT claim.*/@@ -113,13 +115,29 @@ async function runState(await mountState(page, state);mounted = true;}- return createChromiumHarness({+ const harness = createChromiumHarness({page,subject: subjectFor(page, state),cdp,visibleLabel: state.facts.visibleLabel ? undefined : null,related: relatedFor(page, state),});+ if ((state as RadioGroupBindingState).opensMenu !== true) {+ return harness;+ }+ return {+ ...harness,+ abortedPress: async subject => {+ await harness.abortedPress(subject);+ const option = subjectFor(page, state);+ await option.waitFor({state: 'hidden'});+ await page+ .locator('#storybook-root')+ .getByRole('button', {name: 'Sort options'})+ .click();+ await option.waitFor({state: 'visible'});+ },+ };},});}