Repository navigation
fix(native-chat): give each animation a reduced-motion state - #26276
Conversation
📝 WalkthroughWalkthroughThe renderer adds a shared Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The reduced-motion fallback works, though its still-state icon would benefit from a test assertion. No production defect introduced by this change was established. Pre-merge checks |
|
|
Thanks for digging into this, Kelvin. The goal is right, but I'd like to be careful with a single global rule, so I'm going to hold this one for now. My main worry is what happens when an animation is the only thing telling you what's going on. A spinner or a pulsing "working" label is how you know the agent is busy. With the global rule it freezes mid-frame, and nothing else shows that work is happening, so users may not know whether Orca is busy or stuck. Where we drop the motion, we need to show the same thing another way: a still "working" icon or a label. Could we handle reduced motion element by element instead? Each animation can then decide how it says the same thing without moving:
I'd start with native chat first and foremost: the working line, tool and subagent labels, the message rail, the chat's popovers and menus, and the loading spinners there. Once that's in, we can work through the rest of the app the same way. The scroll changes are great and I'd keep them as they are: |
Spinners swap to a still hourglass instead of freezing; chevrons, the rail and popovers stop moving.
6b493a1 to
dbb9e52
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsx (1)
95-95: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the
LoadingSpinnerstill-state icon.
LoadingSpinnerrendersLoader2first andHourglasssecond. The tests usequerySelector('svg'), so they inspect onlyLoader2. A regression that removes or hides theHourglassfallback can pass. Assert the fallback'shidden motion-reduce:blockclasses in both reduced-motion assertions.Suggested fix
const activity = screen.getByText('Working…') const row = activity.closest('[data-native-chat-turn-activity]') const spinner = row?.querySelector('svg') + const stillIndicator = row?.querySelector('.lucide-hourglass') expect(activity).not.toHaveClass('animate-pulse', 'animate-spin') expect(spinner).toHaveClass('size-4', 'animate-spin', 'motion-reduce:hidden') + expect(stillIndicator).toHaveClass('hidden', 'motion-reduce:block')Add the same
stillIndicatorquery and assertion to the running-tool test.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c5672d52-dba1-4cef-be0a-d518facf1e1e
📥 Commits
Reviewing files that changed from the base of the PR and between 6b493a1777564e8bfadab91c94d008f1ad8f6c0d and dbb9e52.
⛔ Files ignored due to path filters (1)
src/renderer/src/components/sidebar/__snapshots__/subagent-child-row-fallback-pixels.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (20)
docs/STYLEGUIDE.mdsrc/renderer/src/components/LoadingSpinner.tsxsrc/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsxsrc/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsxsrc/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsxsrc/renderer/src/components/native-chat/NativeChatDiffCard.tsxsrc/renderer/src/components/native-chat/NativeChatImageAttachmentPreview.tsxsrc/renderer/src/components/native-chat/NativeChatLoadingCue.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageRail.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageCard.tsxsrc/renderer/src/components/native-chat/NativeChatSubagentRun.tsxsrc/renderer/src/components/native-chat/NativeChatSubagentSectionHead.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsxsrc/renderer/src/components/native-chat/NativeChatTurnActivityLine.tsxsrc/renderer/src/components/native-chat/NativeChatWorkingStatus.tsxsrc/renderer/src/components/ui/dropdown-menu.tsxsrc/renderer/src/components/ui/hover-card.tsxsrc/renderer/src/components/ui/popover.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/STYLEGUIDE.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Thanks Brennan, that makes sense. I've reworked this PR the way you described and dropped the global rule:
Two things to flag:
The scroll changes are split out into #26796 as you suggested. |
ELI5
Some people turn on "reduce motion" because moving things on screen make them unwell or distract them. The chat only half listened: some things stopped and others kept moving, and a stopped spinner just looked stuck. Now each moving thing in the chat has a still version that says the same thing.
What Changed
Before: with reduce motion on, the chat's "working" spinner froze as a partial ring, while the loading spinner, the spinners in the
@and/menus and on attachments, the pulsing item in the message rail, the arrow rotations and the popover slide-ins all kept moving.After: with reduce motion on:
With reduce motion off, nothing changes.
Mechanism: each element declares its own reduced-motion state with a
motion-reduce:class. Spinners go through a newLoadingSpinnercomponent that renders the spinning icon and a still hourglass and shows one or the other. The style guide now states the rule: turn movement off, give spinners and pulses a still state that still says "working", and leave short fades alone.Why
An earlier version of this PR used one global CSS rule to stop every animation. That froze spinners mid-frame with nothing else showing that work was happening. Handling each element lets it decide how to say the same thing without moving.
The chat's popovers and menus are the shared popover, dropdown menu and hover card components, so that part applies across the app. Restyling them from the chat is blocked by the design-system lint, and the content says everything without the slide.
The scripted scroll fixes that were here moved to their own PR.
Visual Proof
Captured in the real app: a hidden dev build of this PR's base (before) and this PR's head (after), with reduce motion turned on through Chrome DevTools and confirmed with
matchMedia('(prefers-reduced-motion: reduce)')before every screenshot. The chat runs a local stand-in agent that starts two commands and a helper agent and never finishes them, so the turn stays "working".Working line (reduce motion on). Four frames, about 200 ms apart, zoomed on the icon. Before, the ring stays frozen at the same angle and looks stuck. After, it is a still hourglass.
The "Running 2 commands and running 1 agent" label and the "Audit loader cache · working" subagent rows read the same in both builds.
Reduce motion off (after), for everyone else. The ring still spins, and the label and dot pulses still run.
Menus, rail preview and arrows (reduce motion on). These open within 150 ms, faster than a screenshot lands, so the motion is measured from the element's computed style right after the click or hover:
enteranimation running@and/menus while loadingFully open, both builds draw the same readable menu and preview:
Not captured: the attachment thumbnail spinner, and the rail tick for a message whose older history is still loading. Neither stays in that state long enough to catch locally. The
@loading state lasts only a few milliseconds, so it was read from the page rather than photographed.Captured with React Grab turned off (
VITE_ENABLE_REACT_GRAB=false). In a defaultpnpm devbuild, React Grab's stylesheet loads after the app's and declares its own.hidden, which beatsmotion-reduce:block. So in dev both icons are hidden under reduce motion and the working line shows no icon at all. Packaged builds never load React Grab.Testing
Checked each new class in headless Chromium with reduce motion on and off: the spinner hides and the hourglass shows, the pulse stops and dims, the arrow transition is off, the popover animation is off.
pnpm lintpasses. The native chat and shared component tests pass (3,746).pnpm tcreports one error incommand-receipt-transaction.test.ts, which this PR does not touch and which fails the same way onmain.Not run: the full app, the e2e suite.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
One spinner test updated for the new class and one snapshot regenerated. No new test: the behaviour is a CSS media query the unit environment does not evaluate.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)