fix(ui): give date and time fields the standard focus ring

DateField and TimeField carried a divergent focus vocabulary — a hard
`ring-2 ring-offset-2` that painted a 4 px ring outside the field's
border box, so the highlight was visibly wider than the div and shifted
on focus. Pull both onto the Input vocabulary: a soft 3 px ring hugging
the box, no offset. Also match Input's `text-base md:text-sm`, so a
sub-16 px input no longer triggers iOS Safari's focus auto-zoom. Every
DateField and TimeField in the app inherits the fix.
This commit is contained in:
Marc-André Bombeck committed 2026-08-08 20:53:35 +02:00
1 parent 271e6f5db6
commit 2e5061337b
4 files changed
+33 -2

No files matched your search

@@ -97,4 +97,15 @@ describe("<DateField>", () => {
const html = render(<DateField value="2026-02-19" />);
expect(html).toContain('aria-label="Open date picker"');
});
it("uses the Input focus vocabulary — a ring that hugs the box, no offset", () => {
// Drift guard: the field must share the app's focus ring (soft 3 px, no
// offset) so the highlight never paints wider than the div or jumps on
// focus. The old hard `ring-offset-2` ring is banned here.
const html = render(<DateField value="2026-02-19" />);
expect(html).toContain("focus-within:ring-ring/50");
expect(html).toContain("focus-within:ring-[3px]");
expect(html).not.toContain("ring-offset-2");
expect(html).not.toContain("ring-offset-background");
});
});
@@ -120,4 +120,13 @@ describe("<TimeField> SSR", () => {
expect(html).toContain("min-h-11");
expect(html).toContain("sm:h-10");
});
it("uses the Input focus vocabulary — a ring that hugs the box, no offset", () => {
// Drift guard shared with <DateField>: soft 3 px ring, no offset, so the
// highlight never overflows the div or jumps on focus.
const html = render(<TimeField value="08:30" />, "de");
expect(html).toContain("focus-within:ring-ring/50");
expect(html).toContain("focus-within:ring-[3px]");
expect(html).not.toContain("ring-offset-2");
expect(html).not.toContain("ring-offset-background");
});
});