Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5278 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 1016 1016
Lines 32847 32858 +11
Branches 12176 12173 -3
=======================================
+ Hits 32146 32157 +11
Misses 695 695
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The new effect can throw when ResizeObserver is unavailable and measure reference tokens before their portals commit, leaving the input too short.
2 open issues
What changed in this PR
Updates PromptInput sizing to use the element’s computed line height, padding, and borders instead of design-token formulas, aligning row limits with rendered geometry.
Changes:
- Calculates pixel heights and observes element resizing to respond to padding changes.
- Updates unit assertions and the existing four-row integration expectation.
- Adds a sizing demo and integration coverage for padding overrides, hover changes, overflow, and unlimited rows.
| File | Description |
|---|---|
src/prompt-input/internal.tsx |
Computes heights from element styles and adds resize observation. |
src/prompt-input/__tests__/prompt-input-token-mode.test.tsx |
Uses mocked geometry to verify pixel heights and effect triggers. |
src/prompt-input/__integ__/sizing.test.ts |
Adds browser coverage for sizing behavior in both input modes. |
src/prompt-input/__integ__/prompt-input.test.ts |
Updates the expected four-row height. |
pages/prompt-input/sizing.scss |
Supplies default, large, and hover padding overrides. |
pages/prompt-input/sizing.page.tsx |
Adds textarea and token-mode sizing fixtures. |
Review effort: Balanced
| useEffect(() => { | ||
| if (isTokenMode) { | ||
| requestAnimationFrame(() => adjustInputHeight()); | ||
| } | ||
| }, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder]); | ||
| adjustInputHeight(); | ||
| }, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder, minRows, maxRows]); |
1e7d4c6 to
031431c
Compare
| requestAnimationFrame(() => adjustInputHeight()); | ||
| } | ||
| }, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder]); | ||
| adjustInputHeight(); |
There was a problem hiding this comment.
why did we drop the animation frame?
| return; | ||
| } | ||
| }, [isTokenMode, value, adjustInputHeight, isCompactMode, placeholder, minRows, maxRows]); | ||
| const ro = new ResizeObserver(() => { |
There was a problem hiding this comment.
can we use the useResizeObserver util here?
031431c to
5906bfa
Compare

Description
Replaces the token-based height formula of Prompt input with one that reads the text element's own computed line-height, padding and border, so row heights are exact and a padding change from any source (a class,
:hover,:focus) is picked up through a content-boxResizeObserver. No design-token strings remain in the sizing code.Behaviour changes (visual refresh, comfortable,
minRows1): rows are exactlyrows x line-heightplus padding. Defaults (maxRows3) are unchanged at 30px empty and 70px capped.maxRows1: 26px -> 30px (the line is no longer clipped by 4px);maxRows2: 48px -> 50px;maxRows4: 92px -> 90px;maxRows10: 224px -> 210px. Visual regression will show the 4-row and 10-row pages (simple,shortcuts,container-resize).Related links, issue #, if available: n/a
How has this been tested?
New dev page
prompt-input/sizingand integration testssizing.test.ts(floor, cap and overflow, padding class swap, hover padding,maxRows-1, token mode). All six Prompt input integration suites pass locally (53 tests); the existingmaxRows4 assertion moved from 94px to 92px (outer box). Headless Chrome measurements in visual refresh and classic, comfortable and compact, both modes. Build, unit tests, lint and tsc green.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.