Skip to content

fix: let long page titles wrap in the page editor - #77

Open
charan-rathore wants to merge 1 commit into
CopilotKit:mainfrom
charan-rathore:fix-long-page-title-clipped-68
Open

charan-rathore wants to merge 1 commit into
CopilotKit:mainfrom
charan-rathore:fix-long-page-title-clipped-68

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Fixes #68

What changed

The page title in the page editor was a single-line <input>, so a long title was cut off at the right edge. It is now an auto-growing <textarea> (PageTitleField) that wraps and resizes to its content. Same class name, aria-label, placeholder and 160 character limit as before.

Enter is ignored and pasted line breaks are turned into spaces, so a title stays a single logical line like it was with the input.

Tests

  • Added tests/page-title-field.test.tsx: the field renders as a one-row textarea with the same label and limit, and line breaks are collapsed.
  • npx vitest run: 36 files, 166 tests pass (current main c2569bb).
  • npx tsc --noEmit, eslint on the changed files and prettier --check on the changed files are clean.

Not run

I did not run the production build or look at the page in a browser, so the wrapping and auto-resize are checked by code and the render test only. Narrow-screen layout is not visually checked.

The page title was a single-line input, so long titles were clipped at the right edge. Use an auto-growing textarea that wraps and strips pasted line breaks.

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wrapping page titles fits the template and preserves its accessible label and 160-character limit, but hold merge because resizing clips the title again. Validation: 166 full tests, typecheck, lint, formatting, and production build passed; 8 focused title/autosave tests passed. Chromium used the actual component and styles. No apparent security expansion.

if (!el) return;
el.style.height = 'auto';
el.style.height = `${el.scrollHeight}px`;
}, [value]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Recalculate title height when available width changes. This effect depends only on value. Resizing the actual field from 1440px to 375px leaves clientHeight at 208px while scrollHeight grows to 250px; overflow:hidden clips the last line until the user edits the title. Recalculate on element width changes, covering viewport and panel resizing, and add a browser regression for this case.

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

2 participants