Skip to content

feat(native-chat): dim the message rail until hover, focus or scroll - #39369

Merged
nwparker merged 2 commits into
mainfrom
nwparker/theme-chat-rail-dim
Nov 7, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/theme-chat-rail-dim

Conversation

@nwparker

@nwparker nwparker commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In Chat, the message rail (the ticks on the right edge that jump to your earlier messages) was drawn at full strength the whole time, so in a long thread it competed with the conversation. It now rests dimmed (40% opacity) and comes back to full strength when you use it:

  • Pointer hover over the rail, including while the pointer is on the tick's portaled preview card.
  • Keyboard focus inside the rail (:has(:focus-visible)). Tab or arrow keys reveal it. A mouse click does not pin it lit.
  • Reader scrolling: wheel, trackpad, touch, keyboard scroll keys, a scrollbar press then drag, and wheel over the rail itself.

It fades back about 1 s after the last of those ends: a 300 ms wake window, then a 700 ms CSS delay and a 500 ms fade. It lights in 150 ms. Under prefers-reduced-motion the opacity switches with no transition.

Streaming output and other app-driven scrolls do not wake it. The wake hangs off the existing reader-input path (useNativeChatReaderScrollInput's onReaderScroll), which already tells reader gestures apart from layout and auto-follow writes. Native scroll events only extend a wake for up to 1.5 s after a real input, so scrollbar drags and touch flings stay lit, but auto-follow can never keep the rail on.

How (cost)

  • All the styling is CSS on the rail container: opacity-40 plus hover:, has-focus-visible:, data-[state=open]: and data-awake: variants.
  • useNativeChatRailWake sets and clears a data-awake attribute on the rail's DOM node, with no React state, so scrolling triggers zero React renders. The rail's ref moved up to NativeChatMessageList, which owns the reader-input callbacks.
  • Per gesture it does 2 attribute writes and arms 1 timer, not one per wheel event.

Closes #38610

Visual proof

Captured in the dev app on this branch over CDP, with a 30-turn Claude transcript seeded the same way tests/e2e/native-chat-message-rail.spec.ts does. The "main" column is the same rail with the idle dimming disabled inline, which is exactly how main renders it.

Light
rail light

Dark
rail dark

Measured computed rail opacity in the app, the same in light and dark:

state opacity
rest 0.4
hover 1
400 ms after pointer leaves 1
2 s after pointer leaves 0.4
during wheel scroll 1
2 s after scroll stops 0.4
keyboard focus (focus-visible) 1
after blur 0.4
pointer moved onto preview card, 1.6 s 1
scrollbar press + 1.2 s of drag-driven scrolling 1 throughout
5 streamed transcript rows, no input 0.4 (0 wake writes)
reduced motion transition-property: none

Design choices that could reasonably differ

These are judgement calls, so this PR is opened for review rather than merged:

  • Rest level: 40%. The issue suggested about 30%. At 40%, unselected ticks are effectively foreground/20 and the current tick is foreground/40.
  • Timing: about 1 s hold after the last input, a 500 ms fade out and a 150 ms fade in.
  • The whole rail dims, including the current-message tick. It stays relatively brighter. An alternative is to dim only the unselected ticks and keep the current tick at full strength.

Merge-risk assessment

Low (technically); the visual default is a design call.

  • Blast radius is the rail container's classes plus one small hook.
  • Behaviour is unchanged: ticks, previews, keyboard navigation and jump logic are the same.
  • No setting, IPC or persistence change, so mixed client/server versions are unaffected. The rail is desktop-renderer only; the mobile app has no message rail.

Negative user-facing tradeoffs

  • At rest the ticks fall below the 3:1 non-text contrast guideline. In the built-in light palette, unselected ticks are about 1.6:1 and the current tick about 2.7:1. They return to full contrast on hover, focus or scroll. That is inherent to idle dimming and is the trade the issue asks for. If this is a concern, a higher rest level or keeping the current tick at full strength fixes it.
  • Users who glance at the rail to see where they are will see a fainter indicator until they interact.
  • Wheel input over a nested scroller (a code block) also wakes the rail, even though the transcript itself doesn't move. This is slightly over-eager but harmless.
  • Under reduced motion the rail dims immediately when the pointer leaves, instead of after the 1 s hold, because transition-none drops the delay too.

Validation

  • pnpm tc:web

  • pnpm test on NativeChatMessageRail.test.tsx and the NativeChatMessageList* suites: 15 files, 122 tests pass.

  • oxlint and oxfmt on the changed files.

  • pnpm check:code-quality:changed passes.

  • In the real app (dev build, background launch, throwaway profile, CDP port 9454), I measured every state in the table above in light and dark: hover, leave, wheel, keyboard focus, blur, preview card, scrollbar drag, streaming, and reduced motion.

  • Review: an independent Opus reviewer and Codex. Fixed:

    • reduced motion still animated the wake fade;
    • the rail faded during a long scrollbar drag or touch fling;
    • the rail dimmed while the pointer was on the preview card;
    • every wheel event rewrote the attribute.

    Kept as a documented tradeoff: contrast at rest.

Perf

  • Scanned with perf-scan.
    • The new work per reader input is one timestamp write. The first input of a gesture also does one attribute write and arms one timer. Each native scroll event costs one comparison.
    • Nothing new runs per render, there is no React state, and the one timer is cleared on unmount.
    • Findings: one, fixed. The first version rewrote data-awake on every wheel event (63 attribute mutations for a 60-event gesture). It now writes twice per gesture.
  • Measured over CDP (dev build):
    • Workload: a 60-event wheel gesture over the transcript.
    • 2 data-awake mutations, about 350 style recalcs (about 60 ms total), 23 layouts and 180 ms of script.
    • The transcript's own scroll work dominates; the rail adds 2 small style invalidations.
    • With 5 streamed rows and no input: 0 wake writes.
  • No compositor cost when idle: the opacity transition runs only on state changes, and there is no backdrop-filter and no animation at rest.
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87

The rail drew at full strength the whole time. It now rests at 40% opacity and lights on pointer hover, keyboard focus (focus-visible) or reader scroll input, fading back after about a second idle. Scroll input writes a data attribute on the rail node, so no React render runs per scroll. Reduced motion switches without a fade.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f0a67295-ddfb-4433-bd52-1d5d109ff7b6
Commits

Reviewing files that changed from the base of the PR and between 228263d and 4c2d9d9.

Files selected for processing: 4

  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageRail.test.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageRail.tsx
  • src/renderer/src/components/native-chat/use-native-chat-rail-wake.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nwparker
nwparker merged commit 8e0a684 into main Nov 7, 2026
41 checks passed
@nwparker
nwparker deleted the nwparker/theme-chat-rail-dim branch November 7, 2026 09:18
saltyfireball pushed a commit to saltyfireball/orca that referenced this pull request Nov 7, 2026
…tablyai#39369)

* feat(native-chat): dim the message rail until hover, focus or scroll

The rail drew at full strength the whole time. It now rests at 40% opacity and lights on pointer hover, keyboard focus (focus-visible) or reader scroll input, fading back after about a second idle. Scroll input writes a data attribute on the rail node, so no React render runs per scroll. Reduced motion switches without a fade.

* fix(native-chat): keep the rail lit through drags and its preview, and snap under reduced motion

(cherry picked from commit 8e0a684)
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.

[Feature]: Dim the Chat message rail until you hover or scroll

1 participant