/WRITING · FRONTEND ENGINEERING
Apple's first touchscreen Mac: what web developers need to change
Apple's new MacBook Pro with a PROLED XDR display supports touch. For the web, that means laptops where the trackpad still reports hover while fingers tap the screen. Hover-only menus break, tiny targets frustrate, and device sniffing fails. Here is how to fix all three.
For years "desktop" on the web quietly meant a mouse or trackpad, and "touch" meant a phone or tablet. Windows laptops with touchscreens blurred that line long ago, but most of the web ignored them. That gets harder to ignore now. Apple's product page for the new MacBook Pro with a PROLED XDR display, a tandem OLED panel, lists it as a "Touch display", running on M5 Pro or M5 Max. It is the first Mac with a touchscreen, and it will sit in front of exactly the designers, developers and executives who review our work.
If your site has hover-only menus, tiny icon buttons or code that decides "touch or not" once at page load, this post is for you.
The problem: one screen, two kinds of input
CSS media queries describe input capabilities in two ways. hover and pointer describe the primary input device. any-hover and any-pointer describe every input available. On a phone, the answers agree: no hover, coarse pointer. On a touch laptop they disagree, because the primary input is the trackpad. So (hover: hover) and (pointer: fine) still match, while (any-pointer: coarse) is also true because a finger is available.
That breaks three common patterns. Navigation that reveals submenus on hover gives touch users nothing to tap. Icon buttons sized for a precise cursor are too small for a fingertip. And JavaScript that sets an isTouchDevice flag once, at load, is wrong half the time on a device that switches input from one moment to the next.
The insight: design for the input, not the device
The fix is not to detect Macs. It is to stop treating input as a property of the device. Treat it as a property of each interaction. Pointer Events already give you this: every pointerdown carries a pointerType of "mouse", "pen" or "touch". CSS gives you any-pointer for sizing decisions that must hold whatever input is used next. Put together, three rules cover touch laptops, foldables, tablets with keyboards and whatever ships next year.
Implementation walkthrough
Step 1: size for the coarsest pointer present
Use any-pointer for target sizes, because the question is whether a finger might be used, not whether it is the primary input. WCAG 2.2 sets 24 by 24 CSS pixels as the minimum target size; Apple's own guidance for touch has long been 44 points, which is a sensible default for primary actions.
TAIWO EMMANUEL / CODE NOTE/* Comfortable for a cursor */
.icon-button { inline-size: 32px; block-size: 32px; }
/* If any available pointer is coarse (a finger), grow the hit area without changing the layout grid */
@media (any-pointer: coarse) {
.icon-button { inline-size: 44px; block-size: 44px; }
.menu a { padding-block: 12px; }
}
/* Hover effects are an enhancement only for devices whose primary input can hover */
@media (hover: hover) and (pointer: fine) {
.card:hover { transform: translateY(-2px); }
}Step 2: replace hover-only disclosure with an accessible toggle
A submenu that opens on hover should also open on click or tap and keyboard focus, and announce its state. Hover can still open it for mouse users, but it must never be the only way in.
TAIWO EMMANUEL / CODE NOTEimport { useId, useState } from "react";
export function NavMenu({ label, children }: { label: string; children: React.ReactNode }) {
const [open, setOpen] = useState(false);
const menuId = useId();
return (
<div
onPointerEnter={(e) => { if (e.pointerType === "mouse") setOpen(true); }}
onPointerLeave={(e) => { if (e.pointerType === "mouse") setOpen(false); }}
>
<button
aria-expanded={open}
aria-controls={menuId}
onClick={() => setOpen((v) => !v)} // works for touch, pen, mouse click and keyboard (Enter/Space)
>
{label}
</button>
<div id={menuId} hidden={!open}>{children}</div>
</div>
);
}Note that mouse hover is handled per event, using pointerType, so a finger tapping the same button gets the toggle while a cursor gets the hover behaviour. Nothing is decided at page load.
Step 3: track the current input for richer interactions
Some interactions genuinely differ by input: drag thresholds, long-press menus, how far a slider moves per step. Keep the most recent pointer type in a tiny hook and adapt per interaction.
TAIWO EMMANUEL / CODE NOTEimport { useEffect, useState } from "react";
export type Modality = "mouse" | "touch" | "pen" | "keyboard";
export function useInputModality(): Modality {
const [modality, setModality] = useState<Modality>("mouse");
useEffect(() => {
const onPointer = (e: PointerEvent) => setModality((e.pointerType || "mouse") as Modality);
const onKey = (e: KeyboardEvent) => { if (e.key === "Tab") setModality("keyboard"); };
window.addEventListener("pointerdown", onPointer, { passive: true });
window.addEventListener("keydown", onKey);
return () => {
window.removeEventListener("pointerdown", onPointer);
window.removeEventListener("keydown", onKey);
};
}, []);
return modality;
}
// Example: larger drag threshold for fingers than for a cursor.
export const dragThreshold = (m: Modality) => (m === "touch" ? 10 : 3);Step 4: test on real hardware
Media-query results on brand-new hardware can differ between browsers and change with updates, so treat the matrix above as the pattern, not a guarantee. Test with the trackpad, with touch and with the keyboard on the same page without reloading, and add a quick check to your QA list: can every menu, tooltip action and preview be reached without hovering?
Takeaway
- Apple's touch-enabled MacBook Pro joins Windows touch laptops in a category where hover and touch coexist on one screen.
- On those devices hover can match while a coarse pointer is present, so hover-only UI fails touch users.
- Size targets with any-pointer, open menus on click, tap and focus, and branch on pointerType per event.
- Delete isTouchDevice flags; they were always a guess, and now they are a bug.
References
- 1. MacBook Pro (PROLED XDR display, touch) — Apple, accessed 2 November 2026
- 2. Apple's Pro and Tell event: touchscreen OLED MacBook Pro is now official — Mixed News, October 2026
- 3. pointer media feature — MDN
- 4. any-pointer media feature — MDN
- 5. hover media feature — MDN
- 6. PointerEvent: pointerType property — MDN
- 7. Understanding SC 2.5.8: Target Size (Minimum) — W3C WAI
- 8. Human Interface Guidelines: Accessibility (touch target sizes) — Apple Developer