Skip to content

Translate: keep the stable gutter without a :has() over the chat thread - #18315

Merged
danielhanchen merged 1 commit into
mainfrom
ci/translate-gutter-without-has
Nov 18, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/translate-gutter-without-has

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Translate: keep the stable gutter without a :has() over the chat thread

The long-thread composer gate, tests/studio/playwright_long_thread_gate.py, fails on main since #18293. It fails on every PR that runs it, for example #18062 and #18108, across Frontend build + bundle sanity, Frontend unit tests (Windows) and Composer:

FAIL: :has() matching costs 6.7 ms per keystroke at 200 turns, budget 5.0 ms (1.3x over)
  studio/frontend/src/index.css:5473 (exact text match)
    main:has(.translate-page)

Cause

#18293 added this rule so a classic scrollbar does not narrow the Translate panes:

main:has(.translate-page) { scrollbar-gutter: stable; }

The <main> it matches is the layout's scroll container, and on the chat page that element holds the whole thread. An unanchored :has() there makes Chromium re-walk every descendant on each keystroke. The gate measures exactly that cost, and it grows with the chat.

Fix

The intent is unchanged: while Translate is open, its layout <main> keeps a stable gutter. Only the way that element is selected changes.

  • translate-page.tsx: a layout effect marks the layout <main> that holds .translate-page with data-translate-page while the page is mounted, and removes it on unmount. The page's own root is also a <main>, so the effect starts from its parent.
  • index.css: main:has(.translate-page) becomes main[data-translate-page].

An attribute selector costs nothing per keystroke, and the Translate page renders the same.

Verification

Long-thread gate, run locally on the same host:

:has() at 40 turns :has() at 200 turns Selector matching growth Gate
main 0.76 ms/key 3.86 ms/key 2.11x for 5x the turns (limit 2.0x) FAIL
this PR 0.06 ms/key 0.09 ms/key 0.38 to 0.45 ms/key PASS

Other checks:

  • tests/translate-page.test.ts: 27 passed.
  • npm run typecheck: no errors.

Screenshots

Translate page at 1366x768, before (main) and after (this PR). Each side was built from its own isolated Studio install. Both render the same page, and on both the layout <main> reports scrollbar-gutter: stable. The page width is 1076 px on both sides.

Translate page before and after: identical, stable gutter on both

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T12:41:33.892412Z 55fdfb5 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 55fdfb533c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 55fdfb533c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 208c474 into main Nov 18, 2026
@danielhanchen
danielhanchen deleted the ci/translate-gutter-without-has branch November 18, 2026 12:45
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