Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): auto-merge button fits its label and animates width changes #19111

Mergedflamboh(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/19111/headmerged by maria-rcks View on GitHub

Note

🤖 Claude Opus 5.5 on behalf of Oliver

#18478 made the PR panel's Merge button fit its label and animate width changes with AnimatedWidth. The Auto-merge button, which takes the same header spot when checks aren't passing and the repo allows auto-merge, was left on the old pattern: an inline-grid stacking invisible copies of its label and "Confirm auto-merge?", so it was always as wide as the longest of them. At rest "Auto-merge (merge)" carried ~4.6px of empty space after the label, and every label change (switching merge method in ⋯, arming, "Enabling...") jumped width instantly.

Changes

  1. Auto-merge button (PullRequestDetailPanel.tsx): now uses the same structure as Merge, AnimatedWidth around a grid that reserves only the method label as a minimum, so "Auto-merge (squash and merge)" never shrinks when it becomes "Confirm auto-merge?". It fits its label, animates every width change over 150ms, and the compact header still hides the label.
  2. AnimatedWidth measurement (AnimatedWidth.tsx, also affects Merge): it measured with getBoundingClientRect().width, which includes transforms. Button scales to 0.97 while pressed and eases back, and the confirm label appears on click while that scale is still easing, so it could record a width ~3% short and the overflow-hidden wrapper could clip the end of "Confirm merge?" / "Confirm auto-merge?". It now uses the ResizeObserver entry's contentRect.width (layout size, ignores transforms, keeps fractions; Math.ceil still applies). I couldn't reproduce the clipping in a browser, since automated clicks press and release instantly; this is a correctness fix from reading the code.

Evidence

Captured from a dev server on a sandbox PR with failing checks. Stills are 4× nearest-neighbor upscales of the same crop; red outline = button, cyan = visible label.

Before (main), at rest: button 157.84px, label 123.19px, 11.65px from label to the button's inner edge.

Before: Auto-merge (merge) button with extra empty space after the label

After (this branch), at rest: button 154.00px, label 123.19px, 7.81px to the inner edge (7px padding plus 0.81px of subpixel rounding).

After: Auto-merge (merge) button fitting its label

Before (main): switching Merge → Squash and merge → Merge via ⋯, width jumps instantly.

https://gh-file-drop-api-prod-galwoqjslzlnws6s.oliver-boorstein.workers.dev/f/b3034b895c708020/before-switch-crop.mp4

After (this branch), slowed to 1200ms: same switch, width animates. The transition was slowed with an injected style because the recorder captures only ~7fps; the real duration is 150ms.

https://gh-file-drop-api-prod-galwoqjslzlnws6s.oliver-boorstein.workers.dev/f/7578f7b369d76722/after-switch-crop.mp4

After (this branch), armed: one click shows "Confirm auto-merge?" in full (cancelled afterwards; nothing was enabled).

After: Confirm auto-merge? label fully visible

Verification

  • vp test run src/components/pullRequest/PullRequestDetailPanel.test.tsx: 29/29 passed.
  • apps/web typecheck clean; vp lint and vp fmt on the 2 changed files clean (4 pre-existing warnings in untouched code).
  • Checked in the web app (Chromium) against the sandbox PR. Not checked: desktop app, dark theme, mobile (mobile has its own React Native merge controls and doesn't use this pattern).

Implementation by Claude Opus 5.5 in Claude Code via T3 Code; evidence captured by GPT-6.1 Sol in Codex via T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at f809126

      Macroscope's review found this PR approvable — This is a narrowly scoped web UI fix that reuses existing width-animation logic and changes only merge-button sizing and transitions. Action behavior, accessibility labels, tooltips, and product defaults remain unchanged.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 588efe79-577b-4e09-bbc2-05016cdcecbb
      📥 Commits

      Reviewing files that changed from the base of the PR and between 8ac4b97dae6bff7258fa5091a908116902fbd635 and f809126cc68b27e8a26e5ee1121ce86774877384.

      📒 Files selected for processing (2)
      • apps/web/src/components/AnimatedWidth.tsx
      • apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      📝 Walkthrough

      The auto-merge button now uses AnimatedWidth for its changing label. AnimatedWidth gets the width from the latest resize observer entry, or uses 0 when no entry is available.

      Changes: Auto-merge label sizing

      Layer / File(s)Summary
      Measure and animate the auto-merge label width
      apps/web/src/components/AnimatedWidth.tsx, apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
      AnimatedWidth reads the width from the latest resize observer entry. The auto-merge button uses the normal merge-method label as its sole invisible sizing reference. Its visible enabling, confirmation, and default labels are unchanged.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: maria-rcks

      Merge Risk: ⚪ Minimal · up to f8091

      The auto-merge button adjusts to its visible label, with no lasting clipping or other material user-facing risk established in the reviewed paths. No merge-blocking issue remains.

      Pre-merge checks · Passed 4
      Passed Passed checks (4 passed)
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the primary web UI fix: fitting the auto-merge button to its label and animating width changes.
      Description checkPassedThe description explains the problem, implementation, visual evidence, verification results, and untested areas. It does not use every template heading or provide explicit maintainer approval, but it …
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. maria-rcks merged this9c9ae43

    5. maria-rcks closed this

Sign in to join this conversation.