Skip to content

feat(nav): a small hover motion on each main menu icon - #2447

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feat/menu-icon-hover-motion
Nov 16, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feat/menu-icon-hover-motion

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The product owner liked a detail in Resend's dashboard: when you hover a menu item, its icon moves a little, once, then settles. This PR adds the same to the main items of our left menu.

Hover an item, or reach it with the keyboard, and its icon plays one short motion that fits what it shows. Then the icon rests. It does not loop, bounce or change colour. Submenu entries have no icons, so they don't move.

There is no text change, so en.json and the Help articles are unchanged.

Changes

  • web/src/components/layout/nav-icon.tsx (new): NAV_ICON_MOTIONS pairs each main item's icon with its motion. This is the only place the pairing lives. NavIcon draws the icon with data-nav-motion="<name>".
  • web/src/components/layout/sidebar.tsx:
    • the main items (links and the rows that open a submenu) draw their icon with NavIcon;
    • a locked item keeps its plain icon and does not move;
    • the aside has data-icons-only while the menu shows icons alone (see below).
  • web/src/app/globals.css: a new block, "The left menu's icon motions", with one short rule set per motion.
  • web/src/components/layout/nav-icon.test.tsx (new): the tests below.
Menu item Icon Motion Duration
Chat Sparkles twinkle: the two small stars shrink and come back one after the other, while the big star turns a little 600 ms
Action Center Target pulse: one pulse through the rings, from the centre out 650 ms
Prompts Globe turn: the globe turns once (its meridian narrows, flips and widens) 700 ms
Visibility BarChart3 bars: the bars dip and grow back, left to right 650 ms
AI Referral Traffic LineChart draw: the trend line draws in from the left 650 ms
Ads Megaphone call: the megaphone tips up a little 550 ms
Content FileText write: the text lines write in, one after another 650 ms
Site Audit Gauge swing: the needle swings back and settles on its reading 700 ms
Reports FileBarChart lift: the page lifts 1.5px 500 ms
Competitors Users nudge: the two people shift a little, the one behind first 550 ms

How it works

  • It is CSS only. There is no JS and no new dependency.
  • Each motion moves parts of the lucide SVG (path, circle, picked with :nth-child) with transform-box: fill-box and a transform-origin. Ads and Reports move the whole icon.
  • The motions run on transitions, not keyframes. With a keyframe animation on :hover, the icon snaps back if the pointer leaves mid-motion.
    • --nav-t is a registered number, the motion's clock. It goes from 0 to 1 on hover or focus. Every motion is exactly at rest at 0 and at 1, so the icon stays at rest while the pointer stays.
    • --nav-k is the motion's strength. When the pointer leaves, it fades to 0 in 200 ms, so a motion cut short eases back to rest. Only then does the clock reset to 0, which is not visible.
    • Each part works out its own 0 → 1 → 0 swing (--nav-b), eased out over its share of the clock. This is how parts move one after another.
  • The active item moves the same way.
  • Icons alone: the collapsed menu opens over the page 150 ms after the pointer comes on it. When it opens, it redraws the rows that open a submenu, so their motion would start again mid-way. So with icons alone, the motion starts 250 ms after hover or focus, as the menu opens. Once the menu is open, there is no delay.
  • Known limit: if the pointer leaves a collapsed menu that is open over the page, the menu folds back and redraws those four rows. An icon still moving at that moment goes straight to rest, while the whole menu narrows.
  • No layout shift: only transform and the line's stroke-dashoffset change.

Accessibility

  • Reduced motion: a prefers-reduced-motion: reduce block sets transition: none, transform: none and stroke-dashoffset: 0 on the icons and their parts. Nothing moves.
  • Keyboard: :focus-visible plays the motion like hover does. Tab or the arrow keys in the menu reach each item, and each icon moves once on focus. A mouse click does not count as focus-visible, so it does not play the motion a second time.
  • Browsers without @property show no motion. The menu still works.

How to test

  1. Open the dashboard with the menu open. Hover each main item. Its icon moves once, then rests while the pointer stays on it.
  2. Hover an item and leave it at once. The icon eases back to rest and does not jump.
  3. Hover the current page's item. It moves the same way.
  4. Click into the menu and use ↓ / ↑ (or Tab). Each icon moves once as it gets focus.
  5. Turn on "Reduce motion" (macOS: Accessibility › Display; Windows: Settings › Accessibility › Visual effects › Animation effects off; Chrome DevTools: Rendering › Emulate prefers-reduced-motion: reduce). Nothing moves.
  6. Collapse the menu to icons only, then hover an icon. The menu opens over the page, and the icon moves once as it opens. It does not start a second time.

Checks

  • npx tsc --noEmit -p .: passes.
  • npx vitest run src/components/layout src/lib/use-server-exports.test.ts src/components/agentic/agentic.test.tsx src/lib/insights-trend.test.ts src/lib/dashboard-navigation: 17 files, 227 tests pass.
  • New nav-icon.test.tsx (8 tests):
    • every main item on the real menu has a motion;
    • the sidebar draws each main item's icon with its motion, both open and as icons alone, and marks the icons-alone menu;
    • the active item's icon has its motion;
    • submenu entries and a locked item have none;
    • globals.css has a block for each motion;
    • hover and :focus-visible both play a motion, 250 ms later with icons alone;
    • every duration is between 400 and 700 ms;
    • the prefers-reduced-motion: reduce block turns off transitions, transforms and the dash offset.
  • ESLint and Prettier on the changed files: clean.
  • Checked frame by frame in Chromium on the real Sidebar (a recorded video, dark mode, was reviewed with the owner):
    • every icon is exactly at rest before hover and again after its motion while still hovered;
    • leaving mid-motion is as smooth as the motion itself, with no larger step, and ends at rest;
    • focus plays each motion;
    • with icons alone, the motion starts once as the menu opens, also on a row that opens a submenu;
    • with reduced motion, nothing moves.
  • The new CSS stays intact after both of Next's CSS minifiers (Lightning CSS and cssnano-simple).
  • No migration, no new dependency, no lockfile change.

Generated by Claude Code

Hovering or keyboard-focusing a main item of the left menu plays its icon's
motion once (500-700ms, eased out), and the icon then rests: the globe
turns, the bars dip and grow back, the trend line draws in, the target
pulses, and so on. nav-icon.tsx pairs each icon with its motion; each
motion is a block in globals.css.

The motions run on CSS transitions of two registered custom properties
(a clock and a strength), not keyframes, so a pointer that leaves
mid-motion eases the icon back to rest instead of snapping. Reduced
motion turns them off. No JS, no new dependency.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
A collapsed menu opens over the page 150ms after the pointer comes on it,
and redraws the rows that open a submenu (Action Center, Prompts,
Visibility, Content), so their icon's motion started again mid-way. The
aside now says when it shows icons alone (data-icons-only), and there the
motion starts 250ms after hover or focus, as the menu opens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gkhngyk
gkhngyk merged commit d77d030 into ansvisor:main Nov 16, 2026
13 checks passed
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Brings in ansvisor#2446 (no row counts), ansvisor#2442, ansvisor#2447, ansvisor#2441 and ansvisor#2377.

Conflicts:
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

help/chat/chat.md merged cleanly: main's "Watch the work" text (no row
counts) and this branch's action-title line are both kept (132 words);
updated stays 2026-11-16, last_checked 2026-11-15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2420, which now includes upstream main (ansvisor#2446 no row
counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377).

Conflicts:
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

help/chat/chat.md merged cleanly: updated 2026-11-16, last_checked
2026-11-15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2422, which now includes ansvisor#2420 and upstream main
(ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377). No conflicts;
approved-articles.json checked with yarn vitest run -u src/lib/help
(no change).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2423, which now includes ansvisor#2422, ansvisor#2420 and upstream
main (ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377).

Conflicts:
- help/chat/chat.md: front matter only; took the later last_checked
  (2026-11-16). Both sides' text is kept: main's "Watch the work" (no
  row counts, 148 words) and this branch's look-up-by-code paragraph in
  "Ask about your actions" (146 words).
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Brings in ansvisor#2446 (no row counts), ansvisor#2442, ansvisor#2447, ansvisor#2441 and ansvisor#2377.

Conflicts:
- help/chat/chat.md: front matter only; took the later last_checked
  (2026-11-16), updated stays 2026-11-16. Both sides' sections are kept:
  main's "Watch the work" (no row counts) and this branch's "Open and
  close Settings in the chat menu" (98 words).

approved-articles.json merged cleanly and is current (yarn vitest run -u
src/lib/help: no change).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.

3 participants