Draw the crosshair cursor natively so it moves at mouse speed - #17
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The client reported the cursor feeling slow ("cursor ka speed slow ho rha… mouse dpi normal krdena"). It was, by design:
cursor: none !importantgsap.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: differenceelement, 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: nonehad taken two things away:cursor: pointerrules 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-linktoken.Verified
cursor: pointerleft.text.Cursor.jsxand theFEATURES.cursorflag are removed.