Skip to content

fix(core): truncate long slide titles in the editor header#154

Merged
1weiho merged 1 commit into
1weiho:mainfrom
ridemountainpig:fix/header-title-truncate
May 23, 2026
Merged

fix(core): truncate long slide titles in the editor header#154
1weiho merged 1 commit into
1weiho:mainfrom
ridemountainpig:fix/header-title-truncate

Conversation

@ridemountainpig
Copy link
Copy Markdown
Contributor

@ridemountainpig ridemountainpig commented May 23, 2026

Summary

  • Long deck titles overflowed the editor header and overlapped the right-side controls (Design / Inspect / Present).
  • Swapped the absolute-positioned title overlay for a 3-zone flex layout: side zones are shrink-0, the title sits in a flex-1 min-w-0 middle zone so truncate actually engages.
  • Dropped the brittle max-w-[min(34rem,calc(100vw-22rem))] formula and the pointer-events-none/auto workaround that the absolute overlay needed.

Before / after

At ~900px viewport with a long title, the title used to render in full on top of the Design / Inspect buttons. It now truncates with an ellipsis and leaves a clean gap to the right-side controls.

CleanShot.2026-05-23.at.11.38.17.yafw.balanced.mp4

Test plan

  • pnpm core typecheck
  • pnpm check
  • Verified at 600 / 900 / 1100 / 1280 / 1900px with a long title — truncation triggers when needed, no overlap at any width.
  • Verified rename (pencil → input) still works without overlap.

Trade-off

The title is now centered between the side zones rather than the viewport. When the right zone is wider than the left (typical), the title shifts a few dozen pixels left of the strict viewport center. This is the necessary trade-off for guaranteeing no overlap.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

@ridemountainpig is attempting to deploy a commit to the Yiwei Ho Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Walkthrough

The PR restructures the editor header layout to enable long slide title truncation. The toolbar header simplifies from a relative + justify-between layout to a plain flex structure, and the title container changes from absolutely-positioned to an explicit flex-based centered region, preventing overlap with right-side controls. A changeset documents the patch release.

Changes

Editor Header Refactor

Layer / File(s) Summary
Header layout restructure and title editor centering
packages/core/src/app/routes/slide.tsx, .changeset/header-title-truncate.md
The toolbar <header> wrapper simplifies from relative + justify-between to flex layout. The centered title container transitions from absolutely-positioned with pointer-events management to a flex-based centered layout with the InlineTitleEditor in a flex-1 region followed by right-side controls. Changes are documented in the changeset as a patch release for @open-slide/core.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A header that bends and flows so free,
Long titles now truncate with dignity,
No overlap, no mess, just flex and space—
The UI finds its perfect place! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly matches the main change: fixing long slide titles truncation in the editor header to prevent overlap with right-side controls.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/app/routes/slide.tsx (1)

912-912: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add min-w-0 to the h1 for robust flex-based truncation.

The h1 is a flex child (parent on line 911 has display: flex) and only has the truncate class. For proper flex-based truncation, flex children need min-width: 0 to shrink below their content width—the truncate class provides overflow: hidden and text-overflow: ellipsis but does not set min-width: 0. The established pattern (see home.tsx:478) uses min-w-0 truncate together.

♻️ Proposed fix
-      <h1 className="truncate font-heading text-[13.5px] font-semibold tracking-[-0.01em]">
+      <h1 className="min-w-0 truncate font-heading text-[13.5px] font-semibold tracking-[-0.01em]">
         {title}
       </h1>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/app/routes/slide.tsx` at line 912, The h1 element with
className "truncate font-heading text-[13.5px] font-semibold tracking-[-0.01em]"
is a flex child and needs a min-width reset for proper truncation; update that
h1's className to include "min-w-0" (i.e., use "min-w-0 truncate ...") so the
flex item can shrink and the existing truncate/text-overflow behavior works
correctly.
🧹 Nitpick comments (1)
.changeset/header-title-truncate.md (1)

5-5: 💤 Low value

Consider a more concise description (optional).

The current description is acceptable and follows the guideline (one line, present-tense, user perspective). For maximum brevity, you could shorten it to:

"Truncate long slide titles in the editor header"

The current version is clearer though, so this is optional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/header-title-truncate.md at line 5, Replace the current changeset
header text "Truncate long slide titles in the editor header instead of letting
them overlap the right-side controls." with a more concise one-line
present-tense description such as "Truncate long slide titles in the editor
header" by editing the .changeset header-title-truncate.md file; keep it one
sentence, present-tense and user-focused (the shorter string above is preferred
but optional).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/app/routes/slide.tsx`:
- Line 346: Remove the inline JSX comment that reads "Editorial toolbar — three
zones, hairline separators, mono-folio center" since it describes WHAT and acts
as a section divider; delete that comment token from the slide.tsx JSX block
(the comment node immediately above the editorial toolbar markup) so the code
conforms to the guideline that comments explain WHY only.

---

Outside diff comments:
In `@packages/core/src/app/routes/slide.tsx`:
- Line 912: The h1 element with className "truncate font-heading text-[13.5px]
font-semibold tracking-[-0.01em]" is a flex child and needs a min-width reset
for proper truncation; update that h1's className to include "min-w-0" (i.e.,
use "min-w-0 truncate ...") so the flex item can shrink and the existing
truncate/text-overflow behavior works correctly.

---

Nitpick comments:
In @.changeset/header-title-truncate.md:
- Line 5: Replace the current changeset header text "Truncate long slide titles
in the editor header instead of letting them overlap the right-side controls."
with a more concise one-line present-tense description such as "Truncate long
slide titles in the editor header" by editing the .changeset
header-title-truncate.md file; keep it one sentence, present-tense and
user-focused (the shorter string above is preferred but optional).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7ef98d6-3809-4a86-9cbf-4f76fc4759e3

📥 Commits

Reviewing files that changed from the base of the PR and between a8c702b and bdb3be3.

📒 Files selected for processing (2)
  • .changeset/header-title-truncate.md
  • packages/core/src/app/routes/slide.tsx

@@ -344,8 +344,8 @@ export function Slide() {
<SelectionReporter />
<div className="flex h-dvh flex-col overflow-hidden bg-background text-foreground">
{/* Editorial toolbar — three zones, hairline separators, mono-folio center */}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the comment—it violates the coding guideline.

This comment describes WHAT the code does (three zones, hairline separators) and serves as a section divider. As per coding guidelines, comments should only explain WHY when non-obvious, not WHAT the code does, and should not be section-divider banners.

🧹 Proposed fix
-          {/* Editorial toolbar — three zones, hairline separators, mono-folio center */}
           <header className="flex h-12 shrink-0 items-center gap-2 border-b border-hairline bg-sidebar/85 px-2 backdrop-blur-md md:px-3">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* Editorial toolbar — three zones, hairline separators, mono-folio center */}
<header className="flex h-12 shrink-0 items-center gap-2 border-b border-hairline bg-sidebar/85 px-2 backdrop-blur-md md:px-3">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/app/routes/slide.tsx` at line 346, Remove the inline JSX
comment that reads "Editorial toolbar — three zones, hairline separators,
mono-folio center" since it describes WHAT and acts as a section divider; delete
that comment token from the slide.tsx JSX block (the comment node immediately
above the editorial toolbar markup) so the code conforms to the guideline that
comments explain WHY only.

@1weiho
Copy link
Copy Markdown
Owner

1weiho commented May 23, 2026

@ridemountainpig Hey Yen 👋🏻
LGTM, thanks!

@1weiho 1weiho merged commit 51108f1 into 1weiho:main May 23, 2026
5 of 7 checks passed
@github-actions github-actions Bot mentioned this pull request May 23, 2026
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.

2 participants