Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(InfoTip): the audit reads a hit area only where its layer draws one (#10050)

Christopher Chedeau4776d409b333
diff --git a/packages/core/src/InfoTip/__tests__/InfoTipAudit.a11y.chromium.spec.ts b/packages/core/src/InfoTip/__tests__/InfoTipAudit.a11y.chromium.spec.ts
index a7b28cd3a9..712c15fc74 100644
--- a/packages/core/src/InfoTip/__tests__/InfoTipAudit.a11y.chromium.spec.ts
+++ b/packages/core/src/InfoTip/__tests__/InfoTipAudit.a11y.chromium.spec.ts
@@ -254,7 +254,12 @@ async function observe(page: Page) {
padding: `${style.paddingBlockStart} ${style.paddingInlineEnd} ${style.paddingBlockEnd} ${style.paddingInlineStart}`,
backgroundColor: style.backgroundColor,
cursor: style.cursor,
- hitAreaInsets: [after.top, after.right, after.bottom, after.left],
+ // The touch hit area is the button's `::after`. Where it has no
+ // content it draws no box, so there is no hit area to grow.
+ hitAreaInsets:
+ after.content === 'none' || after.content === 'normal'
+ ? null
+ : [after.top, after.right, after.bottom, after.left],
box: box(button),
icon: icon
? {
@@ -440,8 +445,11 @@ for (const item of cases) {
);
check(button.describedBy !== '', `${where} has no aria-describedby`);
check(
- button.hitAreaInsets.every(inset => Math.abs(parseFloat(inset)) === 0),
- `${where} grows under a fine pointer: ${button.hitAreaInsets.join(' ')}`,
+ button.hitAreaInsets == null ||
+ button.hitAreaInsets.every(
+ inset => Math.abs(parseFloat(inset)) === 0,
+ ),
+ `${where} grows under a fine pointer: ${button.hitAreaInsets?.join(' ')}`,
);
const icon = button.icon;
if (icon == null) {