fix(ui): scale touch targets to the pointer, not the window width
A coarse-pointer-only floor keeps switches, tab triggers and scrolled nav strips from being deformed on a phone, and the topbar reveals the current section after a route change.
This commit is contained in:
5 files changed
+26
-8
No files matched your search
+10
-4
@@ -257,23 +257,29 @@
|
||||
/* Fingers need 44px targets (WCAG 2.5.5). Min sizes rather than heights, so
|
||||
a component's own sizing still applies wherever it is already larger,
|
||||
and inline links in prose are unaffected because min sizes do not apply
|
||||
to inline boxes. */
|
||||
@media (pointer: coarse), (width < 48rem) {
|
||||
to inline boxes. Only a coarse pointer means a finger: a narrow window on
|
||||
a desktop still uses a mouse. Switches and tab triggers are exempt because
|
||||
they shrink their own box (a switch draws its hit area with ::after, tabs
|
||||
share a fixed-height strip), so a min size deforms them instead. */
|
||||
@media (pointer: coarse) {
|
||||
:where(
|
||||
button,
|
||||
button:not([role="switch"], [role="tab"]),
|
||||
a[href],
|
||||
summary,
|
||||
select,
|
||||
textarea,
|
||||
input:not([type="checkbox"], [type="radio"], [type="hidden"]),
|
||||
[role="button"],
|
||||
[role="tab"],
|
||||
[role="menuitem"],
|
||||
[role="option"]
|
||||
) {
|
||||
min-height: 44px;
|
||||
min-width: 44px;
|
||||
}
|
||||
/* Tabs fill their list, so the list carries the touch height instead. */
|
||||
[data-slot="tabs-list"] {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
/* An accessibility invariant, not a nicety: nothing animates for someone
|
||||
who has asked it not to. */
|
||||
|
||||
Reference in new issue
Block a user