Files
piik/tests/tooltip-trigger-label.test.ts
T
AAA 2fe4bccb8e fix(a11y): a tooltip names a disabled control by its text, not by an object
A control may name itself with a copy key or with text it already holds. The tooltip read only the first form, so a disabled control named by text gave its focusable wrapper the accessible name "[object Object]". It now resolves the name as the control itself does.
2026-11-25 22:00:26 -05:00

13 lines
720 B
TypeScript

import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { expect, it } from "vitest";
import { Btn } from "../src/client/components/living/primitives";
import { Tooltip } from "../src/client/components/living/Tooltip";
it("a tooltip around a control named by text carries that text, never an object", () => {
const markup = renderToStaticMarkup(createElement(Tooltip, { overflow: { text: "Friends", selector: ".lr-cap" },
children: createElement(Btn, { icon: "chevron", title: { text: "Site settings" }, cap: { text: "Friends" }, disabled: true }) }));
expect(markup).not.toContain("[object Object]");
expect(markup).toContain('aria-label="Site settings"');
});