Auto-expand Note field up to 7 lines; floor manual resize at 1 line#663
Auto-expand Note field up to 7 lines; floor manual resize at 1 line#663dconger-microsoft wants to merge 3 commits into
Conversation
The clipper Note field grows as the user types, up to a maximum of 7 lines, after which it scrolls. Manual drag-resize (resize: vertical) is preserved: the dragged height is remembered as a floor, so the field never auto-shrinks below it, but typing still grows it to fit content (up to the max). This means collapsing the field and then adding more text re-expands it to an appropriate size. A CSS min-height keeps manual resize from going below a single line (previously it could shrink smaller). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Web Clipper renderer UI so the “Note” textarea auto-expands while typing (up to 7 lines) and enforces a 1-line minimum height, while still honoring a user’s manual resize as a remembered floor (reset on sign-out).
Changes:
- Set the Note textarea default to
rows="1"so it starts at a single line. - Add a CSS
min-heightto prevent manual resize below one line. - Implement note auto-grow behavior in
renderer.ts, including remembering manual resize as a floor and resetting size on sign-out.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/styles/renderer.less | Adds a 1-line minimum height for #note-field. |
| src/scripts/renderer.ts | Adds auto-grow logic, manual-resize floor tracking, and resets sizing on sign-out. |
| src/renderer.html | Changes Note textarea default rows from 2 to 1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses PR review: replace hard-coded NOTE_LINE_HEIGHT/NOTE_VERTICAL_CHROME with values read from getComputedStyle(noteField), so the 7-line cap stays correct if the CSS line-height, padding, or border ever change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The auto-grow-while-typing path is solid — caps cleanly at 7 lines with a working scrollbar. But the manual drag-resize floor is stored unclamped, and that one gap produces three visible bugs: dragging past 7 lines sticks forever, you can't drag back below the cap once you've got >7 lines of text, and the scrollbar disappears after a tall drag. Could we clamp the remembered floor to the 7-line max? Repro'd each against a faithful copy of the CSS+JS (measured offset/scroll heights, not eyeballed). Details for whoever picks this up: Root cause:
Suggested fix — two small changes that resolve all three:
With the floor clamped to the cap, |
Address @wikirby's review on OneNoteDev#663: the manual drag-resize floor was stored unclamped (userPreferredNoteHeight = noteField.offsetHeight), which produced three bugs once a drag exceeded the 7-line auto-grow cap: - dragging past 7 lines stuck forever (inflated floor persisted across typing), - couldn't drag back below the cap with >7 lines of text, - the scrollbar disappeared after a tall drag (overflowY keyed off the floor). Fix (both suggested changes): - renderer.ts: clamp the remembered floor to the cap on mouseup — userPreferredNoteHeight = Math.min(noteField.offsetHeight, getNoteMaxHeight()). - renderer.less: add max-height: 150px to #note-field (7 x 20px line-height + 8px padding + 2px border) so the native resize handle can't physically exceed the cap even before JS runs; mirrors NOTE_MAX_LINES. With the floor clamped to the cap, overflowY keys off content vs. cap and the scrollbar returns. Build + lint pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Great catch @wikirby — thanks for the precise, measured repro. Fixed in
With the floor clamped to the cap, |
|
Separate from the floor bug — the auto-grow has no Where this is most likely to hurt: PDF mode stacks the most controls into the same sidebar column ( One option: keep the 7-line expansion while focused, but collapse to ~2 lines (scrolled) on blur and re-expand on focus — preserves the editing benefit without the resting-state cost. A smaller or mode-aware cap would be a lighter alternative. |
What
The Note field in the clipper now auto-expands as you type, up to a maximum of 7 lines; past that it scrolls.
Behavior
overflow-y: auto).min-height).Existing Behavior

Revised Behavior:

Changes
src/renderer.html- note-field textarea starts atrows="1".src/styles/renderer.less-#note-field { min-height: 30px; }.src/scripts/renderer.ts- auto-grow logic (input / mousedown / mouseup listeners) + reset on sign-out.Testing
Built locally with
npm run build(tsc + eslint) - passes. The repo has no automated test suite (V3 validation = build); verified the bundle in the loaded unpacked extension.Tested locally including cases of adding text, removing text, resizing the notes fielding, adding more text, etc.