Skip to content

Stabilize scrollbar gutter to prevent message list layout shift - #19332

Merged
AmethystLiang merged 2 commits into
mainfrom
improve-chat-ui
Sep 8, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
improve-chat-ui

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 0

Problem

The native chat message list experiences layout shift when the scrollbar appears and disappears, causing content to reflow horizontally. This happens because the scrollbar takes up space, changing the available width.

Solution

Use CSS scrollbar-gutter: stable to reserve scrollbar space consistently, preventing layout shifts. Adjust padding to account for the reserved space while maintaining alignment with the composer field.

ELI5

When scrolling messages, the scrollbar appears/disappears on the right, making text shift left and right. We now reserve that space always, so nothing moves.

What Changed

  • Added [scrollbar-gutter:stable] to scroll container to reserve scrollbar space
  • Updated padding from px-3/sm:px-4 to pr-3/pl-[calc(theme(spacing.3)+12px)] and responsive sm:pr-4/sm:pl-[calc(theme(spacing.4)+12px)] to account for gutter
  • Added px-[5px] horizontal inset to message content for slight narrowing vs. composer width
  • Clarified layout comments

Why

Layout shifts harm UX and break selections. scrollbar-gutter: stable is the modern CSS standard for this problem.

Linked Issue

N/A

Visual Proof

TODO: Add before/after video showing scrolling behavior without layout shift

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md

Notes

CSS change only; no platform, SSH, or compatibility impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

- Add `scrollbar-gutter:stable` to prevent reflow when scrollbar appears
- Adjust scroll container padding to properly accommodate the scrollbar
- Add 5px horizontal inset to content for alignment with composer field
@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: bb0cfbad-b178-45d8-9561-ac0302550c80

📥 Commits

Reviewing files that changed from the base of the PR and between 2480939 and 10e3840.

📒 Files selected for processing (1)
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The native chat transcript now uses symmetric responsive horizontal padding and a stable scrollbar gutter. The inner transcript adds a 5px horizontal inset while retaining the shared maximum width.

Merge Risk: ⚪ Minimal · up to 10e38

This CSS-only change reserves scrollbar space and adjusts transcript insets to prevent chat layout reflow. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, scope, and main implementation details. However, it does not provide the required linked issue, visual proof for this UI behavior change, or testing res… Add a valid linked issue after “Fixes #”. Attach before-and-after visual proof, or write N/A with a reason only if there is no visual or interaction change. Document manual testing, automated test coverage or the reason tests were not add…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preventing message list layout shifts caused by scrollbar behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, scope, and main implementation details. However, it does not provide the required linked issue, visual proof for this UI behavior change, or testing results. Several required checklist items remain incomplete.

Resolution

Add a valid linked issue after “Fixes #”. Attach before-and-after visual proof, or write N/A with a reason only if there is no visual or interaction change. Document manual testing, automated test coverage or the reason tests were not added, and relevant lint, typecheck, test, and build results.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot 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.

Important

The new left-padding calc() utilities on the scroll container generate invalid CSS, so the message list loses its left padding entirely and content will sit flush against the left edge — a visible regression in the core chat flow. Details inline; fix before merging.

Reviewed changes

  • Scrollbar gutter stabilization — adds [scrollbar-gutter:stable] to the message scroll container and reworks horizontal padding so content stays aligned with the composer column.
  • Content column inset — adds px-[5px] to the max-w-4xl message column so messages sit slightly narrower than the input box, with a clarified Why comment.

ℹ️ Missing visual proof for a UI-only change

The PR's "Visual Proof" is still TODO and the "Before/after screenshots or videos" checklist item is unchecked. This is a subtle alignment tweak that can't be validated from static review — please attach a before/after capture (or mark N/A with a reason) before merging.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • Scrollbar gutter stabilization — replaced the invalid left-padding calc() utilities with [scrollbar-gutter:stable_both-edges] plus symmetric px-3 sm:px-4, reserving the gutter on both edges so the max-w-4xl column stays centered without hardcoding the scrollbar width.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang merged commit 1a8640a into main Sep 8, 2026
27 checks passed
@pullfrog pullfrog Bot mentioned this pull request Sep 10, 2026
8 of 9 tasks
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