Skip to content

fix(page-title): wrap long page titles instead of clipping them - #136

Open
Yi-111-a wants to merge 1 commit into
CopilotKit:mainfrom
Yi-111-a:fix/page-title-wrapping
Open

Yi-111-a wants to merge 1 commit into
CopilotKit:mainfrom
Yi-111-a:fix/page-title-wrapping

Conversation

@Yi-111-a

Copy link
Copy Markdown

Fixes #68

Problem

The page title field is a single-line <input> (aria-label="Page title"), so a long title is clipped at the right edge instead of wrapping. For example "AI Coworkers: OpenAI Dots vs Meta Muse vs OpenDots" shows as "AI Coworkers: OpenAI Dots vs Meta Mus" in a ~1300 px window.

Fix

Render the title as a wrapping, auto-growing <textarea> instead of a single-line <input>:

  • The field wraps (white-space: pre-wrap; overflow-wrap: break-word) and grows to fit every line, so no title is clipped horizontally.
  • rows={1} plus a content-height effect (and field-sizing: content where supported) keep it exactly one line tall until the text actually wraps.
  • Because a title is a single paragraph, Enter leaves the field; Shift+Enter still inserts a line break for the rare case a break is wanted.

The existing aria-label, placeholder, maxLength and the autosave path (controller.edit({ title })) are unchanged.

Verification

  • New regression tests in tests/page-document-title.test.tsx cover the element type/props and the Enter vs Shift+Enter handling.
  • vitest: my two new tests pass. The 7 pre-existing failures in the suite are unrelated — they come from node:sqlite requiring Node >=22 while this environment runs Node 20, and they fail identically on the unmodified tree.
  • tsc --noEmit, eslint and prettier --check are clean on the changed files.

The page title was a single-line <input>, so a long title ran off the
right edge instead of wrapping. It is a wrapping, auto-growing textarea
now: Enter leaves the field and Shift+Enter still starts a new line, so
a title stays a single paragraph. Regression tests cover the element and
its key handling.
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.

Long page titles are clipped in the page editor

1 participant