fix(web): smooth the sidebar nav hover nudge - #330
Merged
Conversation
The sidebar nav links carry hover:translate-x-0.5, and .row-interactive already declared a transition on transform, so the CSS read as correct. It was not: Tailwind v4 compiles translate-, scale- and rotate- utilities to the standalone translate, scale and rotate properties rather than folding them into transform, so nothing was transitioning the property that actually changes and the nudge snapped instantly. The hover colour change snapped too, since color was never in the list either. List all four properties on the shared interactive base rule, not just on .row-interactive, so the same latent bug cannot resurface the next time a hover:scale- or hover:rotate- utility is added somewhere else. ItemList's icon was already smooth because it uses Tailwind's own transition-transform utility, which does expand to transform, translate, scale and rotate. While in here, three things that make the menu hover read better: the row now eases in faster than it settles back, which feels responsive rather than twitchy; focus-visible reveals the brand bar so keyboard users get the same affordance as the pointer; and under prefers-reduced-motion the sideways nudge is dropped outright, since the global rule only zeroed the duration and left the row still jolting.
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 bug
The sidebar nav links carry
hover:translate-x-0.5, and.row-interactivealready declaredtransition: transform 0.2s, so the CSS read as correct. It was not.Tailwind v4 compiles
translate-*to the standalonetranslateproperty, not totransform. Verified against the pinned 4.3.2 CLI:Nothing was transitioning the property that actually changes, so the nudge snapped instantly.
hover:text-foregroundsnapped too, sincecolorwas never in the transition list either.The fix
All four of
transform,translate,scaleandrotateare now listed, on the shareda, button, input, ...base rule as well as on.row-interactive, so the same latent bug cannot resurface the next time ahover:scale-*orhover:rotate-*is added elsewhere in the app.ItemList.tsx:315was already smooth and is untouched: it uses Tailwind's owntransition-transformutility, which does expand totransform, translate, scale, rotate.Hover polish
Three changes that make the menu hover read better:
:focus-visiblereveals the brand bar, so keyboard users get the same affordance the pointer already had.prefers-reduced-motiondrops the nudge entirely. The existing global rule only zeroed the transition duration, which left the row still jolting sideways. The brand bar and background now carry the hover state on their own. No!importantneeded: the custom rules are unlayered and Tailwind's utilities sit in@layer utilities.Verification
npm run buildclean, 219/219 unit tests passingtransitiondeclaration and the reduced-motion rule in the minified production CSS, not just in sourceNot visually confirmed in a browser.