a11y(medications): focus-visible ring + 44 px touch floor on intake-history sort headers

Sort headers relied on hover:underline only and dropped below the
44 px touch target floor on mobile. Add focus-visible:ring-* and
min-h-11 sm:min-h-9 so keyboard + touch users can hit the column
header reliably.
This commit is contained in:
Marc-André Bombeck committed 2026-05-17 12:58:08 +02:00
1 parent 476ba98eae
commit 00cf8d7a8c
2 files changed
+25 -2

No files matched your search

@@ -193,6 +193,29 @@ describe("<IntakeHistoryListV2> — sort indicators", () => {
expect(html).toContain("arrow-up-down");
});
it("applies focus-visible ring + min-h-11 to sort header buttons", () => {
const client = makeClient();
seedIntake(client, "med-a11y", [
{
id: "evt-1",
medicationId: "med-a11y",
scheduledFor: "2026-05-15T08:00:00.000Z",
takenAt: "2026-05-15T08:02:00.000Z",
skipped: false,
source: "WEB",
createdAt: "2026-05-15T08:02:00.000Z",
},
]);
const html = render(
<IntakeHistoryListV2 medicationId="med-a11y" />,
client,
);
expect(html).toContain("focus-visible:ring-ring");
expect(html).toContain("focus-visible:ring-2");
expect(html).toContain("focus-visible:ring-offset-2");
expect(html).toContain("min-h-11");
});
it("renders pagination controls only when more than one page", () => {
const client = makeClient();
// 50 total > pageSize 25 → pagination should render
@@ -188,7 +188,7 @@ export function IntakeHistoryListV2({
<button
type="button"
onClick={() => toggleSort("takenAt")}
className="inline-flex items-center font-medium hover:underline"
className="focus-visible:ring-ring inline-flex min-h-11 items-center rounded-md font-medium hover:underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none sm:min-h-9"
aria-label={t("medications.intakeHistorySortByTaken")}
>
{t("medications.intakeHistoryColTaken")}
@@ -199,7 +199,7 @@ export function IntakeHistoryListV2({
<button
type="button"
onClick={() => toggleSort("scheduledFor")}
className="inline-flex items-center font-medium hover:underline"
className="focus-visible:ring-ring inline-flex min-h-11 items-center rounded-md font-medium hover:underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none sm:min-h-9"
aria-label={t("medications.intakeHistorySortByScheduled")}
>
{t("medications.intakeHistoryColScheduled")}