Skip to content

fix(web): PR Code tab file tree and toolbar stay inside narrow panes - #445

Merged
johnnyelwailer merged 3 commits into
mainfrom
nexi/pr-detail-responsive
Oct 8, 2026
Merged

johnnyelwailer merged 3 commits into
mainfrom
nexi/pr-detail-responsive

Conversation

@johnnyelwailer

@johnnyelwailer johnnyelwailer commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Fixes the PR detail Code tab on narrow panes, slim windows and phones (Phil's report: the file-tree sidebar was cut off past the window's right edge, and the view was poor on slim and mobile widths).

What changed:

  1. The file tree no longer runs off the right edge. Its pane used to size itself to the longest file path, so it grew past its 20rem slot and the diffstats, the "viewed" count and the header buttons were clipped (145 to 160px cut off at every width we measured). The pane now fills the slot it is given and long names truncate inside it.
  2. The tree only docks beside the diff when the Code tab has room for both: 50rem for the stacked diff (as before), 64rem for split. Otherwise the tree toggle opens it as a drawer over the diff. The width is measured on the Code tab itself, not the window, so the half-window side panel, the undocked window and a phone all behave the same.
  3. On slim toolbars (below 36rem) the whitespace, wrap, layout and collapse-all toggles move into the View options menu under a new "Diff" group. The scope picker, file count, prev/next, the tree toggle and the menu stay visible and are never pushed off the edge (before: the menu was 13 to 44px off-screen at 390px, 16px off at 700px).
  4. The toolbar's padding no longer depends on its own width check (it is px-2 on small viewports, px-4 from sm up). This fixes the flip-flop Codex flagged at pane widths around 592 to 607px.

The width rules live in the fork-owned t3team-prCodeLayout.logic.ts with unit tests, so the upstream-derived PullRequestCodeTab.tsx diff stays small and additive.

Screenshots: real app on the box against this repo's PR #440. Before is current main, after is this branch.

Undocked window, 1440px, tree open
Before:
before 1440
After:
after 1440

PR page with list, 1024px, tree open (the detail pane is about 400px wide, so the tree opens as a drawer)
Before:
before 1024
After:
after 1024

Slim window, 700px
Before (toolbar):
before 700
After (toolbar):
after 700
Before (tree open):
before 700 tree
After (tree open):
after 700 tree

Phone, 390px
Before:
before 390 before 390 tree
After:
after 390 after 390 tree

Measured overflow (px cut off past the right edge, before -> after), tree / View options menu:
1440: 145 -> 0 / 0 -> 0
1024: 145 -> 0 / 0 -> 0
700: 160 -> 0 / 16 -> 0
390: 160 -> 0 / 44 -> 0
No horizontal page overflow at any width after the change.

Tests: t3team-prCodeLayout.logic.test.ts, t3team-prDiffExplorer.logic.test.ts and PullRequestDetailPanel.test.tsx pass (46 tests). apps/web typecheck is clean. Format, lint (no new warnings) and the additive guard pass.

Not in this PR: on the PR list page at phone width, the list column still shows as a thin sliver to the left of the detail pane. That comes from the shared inline RightPanelTabs layout, which chat uses too, so it needs its own change.

…panes

- File tree pane fills the width its parent gives it instead of sizing itself to the
  longest compacted path; as a shrink-0 flex child it grew past its 20rem slot and the
  diffstats, counts and header buttons were clipped at the window's right edge.
- Dock the tree beside the diff only when the Code tab row has room for both
  (stacked 50rem as before, split 64rem); otherwise it opens as a drawer.
- Below 36rem the toolbar moves whitespace / wrap / layout / collapse-all into the
  View options menu so the tree toggle and the menu are never clipped.
- Width rules live in t3team-prCodeLayout.logic.ts (+ unit tests) to keep the
  upstream-derived PullRequestCodeTab.tsx diff small.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T22:04:50.868832Z 6cef2b2 PR opened
ℹ️ 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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cef2b23c9

ℹ️ 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".

Comment on lines +1253 to +1255
className={cn(
"flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background text-xs text-muted-foreground",
compactToolbar ? "px-2" : "px-4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the toolbar's width-measurement feedback loop

When the pane is 592–607px wide, the toolbar can oscillate continuously between compact and full modes. useElementFitsWidth compares ResizeObserverEntry.contentRect.width, which excludes padding, while this conditional changes horizontal padding from 16px to 32px: compact mode therefore measures at least 576px and switches to full, whose content width then falls below 576px and switches back. This can produce repeated renders/ResizeObserver loop errors and a flickering toolbar at common resized-panel widths; keep the measured element's padding constant or measure a padding-independent parent.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 601d80b.

This comment will update automatically after the next completed run.

Philip Jonientz added 2 commits October 8, 2026 08:09
…eck cannot flip-flop

The toolbar measures its own content box to decide whether to compact. Its
padding used to follow that decision (px-2 compact, px-4 full), so a pane
between about 592px and 607px wide toggled between the two on every
resize-observer tick. The padding is now viewport-based (px-2, sm:px-4) and
independent of the measured result. Addresses the Codex review on #445.
@johnnyelwailer johnnyelwailer changed the title fix(web): PR Code tab file tree + toolbar no longer cut off on narrow panes fix(web): PR Code tab file tree and toolbar stay inside narrow panes Oct 8, 2026
@johnnyelwailer
johnnyelwailer merged commit 1bdc352 into main Oct 8, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant