diff --git a/canvas/src/components/__tests__/Tooltip.test.tsx b/canvas/src/components/__tests__/Tooltip.test.tsx index e5b07f7e..ec82240b 100644 --- a/canvas/src/components/__tests__/Tooltip.test.tsx +++ b/canvas/src/components/__tests__/Tooltip.test.tsx @@ -269,4 +269,19 @@ describe("Tooltip — aria-describedby", () => { // The describedby id matches the tooltip id in the portal expect(document.getElementById(describedBy!)).toBeTruthy(); }); + + // WCAG 1.4.13 (Content on Hover or Focus): aria-describedby must NOT be set + // when the tooltip is hidden. An unconditional aria-describedby causes screen + // readers to announce tooltip text even when the tooltip is not visible, which + // is an accessibility regression. The fix makes it conditional on `show`. + it("does NOT set aria-describedby when tooltip is hidden (WCAG 1.4.13)", () => { + render( + + + + ); + // Without any hover/focus, the tooltip is not shown + const wrapper = document.body.querySelector('[aria-describedby]'); + expect(wrapper).toBeNull(); + }); });