0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(ui): make sidebar hover instant (#29244)

> Opened by @damien-schneider

Hover in the sidebar now switches instantly, the same way menu and list
rows have since #28757. Before this change, sidebar rows faded their
highlight and label colour over 150ms, so the highlight trailed the
pointer. Other hover effects in the sidebar also faded in. Studio,
Platform and Factory all use this sidebar, so all three now behave the
same.

## What changed

Shared sidebar (`@mastra/playground-ui`):
- **Nav rows** (including rows with a trailing action, such as every
Factory session row, and the Factory user menu row): the background,
which is drawn on a `::before` layer, and the label colour now switch
instantly. This uses `transition-none before:transition-none` on the row
surface that carries `state-layer`, the same approach as `menu-item.ts`.
- **Section header links** and **Show N more**: the colour fade is
removed.
- **Usage meter** (when it is a link): the background fade is removed.
- **Resize handle**: the hairline now appears instantly on hover instead
of fading in over 150ms.
- **Collapsed logo and toggle**: hovering the collapsed sidebar now
swaps them instantly. The `sidebar-hold` keyframe still stops the toggle
from flashing while the sidebar collapses.

Factory:
- **Session preview timeline** (`SessionTrack`): segments now dim and
highlight instantly as the pointer moves over them, with no opacity or
background fade.

Things that move or appear keep their animation: popovers and hover
cards opening, sidebar collapse and resize, and nav-stack page
transitions. Buttons keep their current behaviour.

The Tailwind v4 rule order was checked: `before:transition-none` is
emitted after the `state-layer` utility, at the same specificity, so it
takes precedence over the utility's background transition.

## Testing

1. In Studio, Platform and Factory, sweep the pointer over sidebar rows,
including Factory session rows. Each row lights instantly, and the label
colour changes immediately.
2. Hover the sidebar's right edge. The resize hairline appears
immediately.
3. In Factory, hover a session row, then move across the preview
timeline. Segments switch without fading.
4. In Studio, collapse the sidebar and hover it. The logo and the toggle
swap instantly, with no flash during the collapse.
5. `vitest run src/ds/components/Sidebar` in playground-ui passes (147
tests, including a regression test that the hover fill is instant on
rows with and without a trailing action). The SessionTrack MSW test
passes. playground-ui and factory-ui typecheck, and oxlint and oxfmt are
clean.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

Sidebar controls and Factory timeline segments now react to hover
without fading. This makes the hovered item easier to identify.

## Changes

- Removed hover transitions from sidebar navigation rows, section links,
“Show more,” linked usage meters, the resize handle, and collapsed logo
and toggle overlays.
- Updated Factory `SessionTrack` segments to change opacity and
background without transitions.
- Added a regression test for sidebar rows with and without trailing
actions.
- Added patch changesets for `@mastra/playground-ui` and
`@mastra/factory`.

## Validation

The PR description reports 147 passing sidebar tests, including the
regression test, and a passing `SessionTrack` MSW test. It also reports
passing playground-ui and factory-ui typechecks, clean oxlint and oxfmt
checks, and successful manual hover checks. These results were not
independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
mastra-platform[bot] 2026-11-03 02:39:31 +01:00 • committed by GitHub
commit df76f896b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 40 additions and 14 deletions