fix: let long page titles wrap in the page editor - #77
charan-rathore wants to merge 1 commit into
Conversation
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
left a comment
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
[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.
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
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.