Skip to content

Draw the crosshair cursor natively so it moves at mouse speed - #17

Merged
laveshparyani merged 1 commit into
mainfrom
fix/native-cursor
Oct 5, 2026
Merged

laveshparyani merged 1 commit into
mainfrom
fix/native-cursor

Conversation

@laveshparyani

Copy link
Copy Markdown
Collaborator

The client reported the cursor feeling slow ("cursor ka speed slow ho rha… mouse dpi normal krdena"). It was, by design:

  • the real pointer was hidden everywhere with cursor: none !important
  • a page element then eased after the mouse over 0.32 s (gsap.quickTo, "trails by a beat")

Removing the easing alone isn't enough. A cursor the page draws always runs a frame or two behind the one the operating system draws, because it can only move when the page renders.

Fix

The same crosshair and the same hover reticle are now CSS cursor images — 32×32 SVG data URIs, hotspot at the centre, each ending in a keyword fallback (crosshair / pointer). The OS draws them, so they move at mouse speed, with no JavaScript and no per-frame work. Applied only on fine pointers ((pointer: fine) and (hover: hover)).

It can no longer invert against what's underneath like the old mix-blend-mode: difference element, so it's dark ink with a 1 px light halo. Checked on the measured page ground (#e6e5e1) and on the footer.

Also restored

cursor: none had taken two things away:

  • The text cursor in inputs and the textarea is back.
  • One consistent clickable cursor. Six class-level cursor: pointer rules would have beaten a plain element rule, so some buttons would show the hand and others the reticle. They now all use the same --cursor-link token.

Verified

  • Minified CSS: tokens intact inside the media query, fallbacks present, zero cursor: pointer left.
  • In the browser: both images decode at 32×32; page text shows the crosshair; nav links, buttons, the Call/WhatsApp buttons, select, labels and footer links show the reticle; input and textarea show text.

Cursor.jsx and the FEATURES.cursor flag are removed.

The client reported the cursor feeling slow. It was: the native pointer was
hidden with cursor: none and a page element eased after the mouse over 0.32 s,
on purpose. Even with the easing removed, a cursor the page draws runs a frame
or two behind the one the operating system draws, so the fix is to let the OS
draw it.

The same crosshair and the same hover reticle are now CSS cursor images:
32 x 32 SVG data URIs, hotspot at the centre, each with a keyword fallback.
They move at the speed of the mouse, need no JavaScript, and cost nothing to
render. Fine pointers only.

It can no longer invert against what is underneath, as the old one did with
mix-blend-mode: difference, so it is ink with a 1 px light halo. Checked on the
measured page ground and on the footer.

Two things come back that cursor: none had taken away: the text cursor in
inputs and the textarea, and a consistent clickable cursor everywhere — six
class-level cursor: pointer rules now use the same token, so every link and
button shows the reticle rather than some showing the hand.

Cursor.jsx and the FEATURES.cursor flag are gone.
@laveshparyani
laveshparyani merged commit b9a142f into main Oct 5, 2026
3 checks passed
@laveshparyani
laveshparyani deleted the fix/native-cursor branch October 5, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant