Skip to content

fix: chat ui msg misalignment#2785

Merged
Davidknp merged 1 commit into
mainfrom
chat-ui-ff
Jul 7, 2026
Merged

fix: chat ui msg misalignment#2785
Davidknp merged 1 commit into
mainfrom
chat-ui-ff

Conversation

@Davidknp

@Davidknp Davidknp commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

the scrollbar on devices that have a mouse connected lead to a misalignment between the transcript messages and the sticky messages in the chat ui

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes pinned chat-message alignment to use measured transcript geometry. The main changes are:

  • Added a width-probe based column offset and width measurement.
  • Applied the measured geometry to the pinned overlay column.
  • Removed fixed overlay gutter padding from the pinned overlay CSS.
  • Added a contract test for pinned card alignment.

Confidence Score: 4/5

The changed flow looks mergeable after tightening the zero-width measurement fallback.

  • The new measured overlay path matches the intended transcript-column alignment.
  • A transient zero-width probe can leave pinned overlay geometry stale or collapsed.
  • The issue is limited to unusual content-class or layout transitions.

packages/chat-ui/src/ChatRoot.tsx

Important Files Changed

Filename Overview
packages/chat-ui/src/ChatRoot.tsx Adds transcript-column geometry measurement and applies it to pinned user-message overlays.
packages/chat-ui/src/chat-root.css.ts Moves pinned overlay alignment responsibility from fixed gutter padding to a measured inner column.
packages/chat-ui/src/chat-view.contract.test.tsx Adds browser-facing coverage that compares the pinned user card against the measured transcript width probe.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/chat-ui/src/ChatRoot.tsx:368
**Zero-Width Probe Freezes Geometry**

When a host `contentClass` temporarily makes the width probe measure `0`, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial `0px` width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.

Reviews (1): Last reviewed commit: "fix: chat ui msg misalignment" | Re-trigger Greptile

if (!widthProbeEl || !outerEl) return;
const probeRect = widthProbeEl.getBoundingClientRect();
const outerRect = outerEl.getBoundingClientRect();
if (probeRect.width <= 0) return;

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.

P2 Zero-Width Probe Freezes Geometry

When a host contentClass temporarily makes the width probe measure 0, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial 0px width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/chat-ui/src/ChatRoot.tsx
Line: 368

Comment:
**Zero-Width Probe Freezes Geometry**

When a host `contentClass` temporarily makes the width probe measure `0`, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial `0px` width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.

How can I resolve this? If you propose a fix, please make it concise.

@Davidknp
Davidknp merged commit aee717c into main Jul 7, 2026
1 check passed
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