Skip to content

Commit 4e48c5d

Browse files
author
Eugene Olonov
committed
Fix unlabelled role mod test for card action and live region changes on main
#5900 removed the capture-phase click listener from the card root, so Chrome now leaves the role-less card out of the accessibility tree (role "none") instead of exposing it as "generic". Assert that neither card is a "figure" or a "form" instead. The live region now reads the text of cards without "speak" (#5922), update the snapshot.
1 parent 53e479d commit 4e48c5d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎__tests__/html2/accessibility/adaptiveCard/hack.roleMod.unlabelled.html‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,18 @@
7575
// THEN: Both cards should have no role, as "figure" and "form" without a name are announced without their content.
7676
expect(cardElements.map(cardElement => cardElement.getAttribute('role'))).toEqual([null, null]);
7777

78+
const cardRoles = (
79+
await Promise.all(cardElements.map(cardElement => testHelpers.getAccessibilityNode(cardElement)))
80+
).map(({ role }) => role?.value);
81+
7882
// THEN: Neither card should be a "figure" or a "form" in the accessibility tree.
79-
expect(
80-
(await Promise.all(cardElements.map(cardElement => testHelpers.getAccessibilityNode(cardElement)))).map(
81-
({ role }) => role?.value
82-
)
83-
).toEqual(['generic', 'generic']);
83+
// Without a role, Chrome may leave the card out of the accessibility tree (role "none") and expose its content directly.
84+
expect(cardRoles).not.toContain('figure');
85+
expect(cardRoles).not.toContain('form');
8486

8587
await pageConditions.liveRegionStabilized();
8688

87-
// THEN: The live region shows what screen readers announce: "Bot said:", "A card:" for each card, then the input and the "Submit" button of the second card.
89+
// THEN: The live region shows what screen readers announce: "Bot said:", "A card:" with the text of each card, then the input and the "Submit" button of the second card.
8890
await host.snapshot('local');
8991
});
9092
</script>
1001 Bytes
Loading

0 commit comments

Comments
 (0)