Skip to content

fix(web): smooth the sidebar nav hover nudge - #330

Merged
vineethkrishnan merged 1 commit into
mainfrom
fix/sidebar-hover-transition
Jul 29, 2026
Merged

fix(web): smooth the sidebar nav hover nudge#330
vineethkrishnan merged 1 commit into
mainfrom
fix/sidebar-hover-transition

Conversation

@vineethkrishnan

Copy link
Copy Markdown
Owner

The bug

The sidebar nav links carry hover:translate-x-0.5, and .row-interactive already declared transition: transform 0.2s, so the CSS read as correct. It was not.

Tailwind v4 compiles translate-* to the standalone translate property, not to transform. Verified against the pinned 4.3.2 CLI:

.hover\:translate-x-0\.5 {
  --tw-translate-x: calc(var(--spacing) * 0.5);
  translate: var(--tw-translate-x) var(--tw-translate-y);
}

Nothing was transitioning the property that actually changes, so the nudge snapped instantly. hover:text-foreground snapped too, since color was never in the transition list either.

The fix

All four of transform, translate, scale and rotate are now listed, on the shared a, button, input, ... base rule as well as on .row-interactive, so the same latent bug cannot resurface the next time a hover:scale-* or hover:rotate-* is added elsewhere in the app.

ItemList.tsx:315 was already smooth and is untouched: it uses Tailwind's own transition-transform utility, which does expand to transform, translate, scale, rotate.

Hover polish

Three changes that make the menu hover read better:

  • Asymmetric timing - 0.14s arriving, 0.22s settling back. Responsive rather than twitchy.
  • :focus-visible reveals the brand bar, so keyboard users get the same affordance the pointer already had.
  • prefers-reduced-motion drops 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 !important needed: the custom rules are unlayered and Tailwind's utilities sit in @layer utilities.

Verification

  • npm run build clean, 219/219 unit tests passing
  • Confirmed the emitted transition declaration and the reduced-motion rule in the minified production CSS, not just in source

Not visually confirmed in a browser.

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.
@vineethkrishnan
vineethkrishnan merged commit d93a39c into main Jul 29, 2026
7 checks passed
@vineethkrishnan
vineethkrishnan deleted the fix/sidebar-hover-transition branch July 29, 2026 08:44
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