feat: add --vaadin-input-field-height custom CSS property - #12574
feat: add --vaadin-input-field-height custom CSS property#12574web-padawan wants to merge 1 commit into
Conversation
d3462da to
cc5c4d0
Compare
|
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 1 comment and collected 1 finding below that could not be attached to the diff.
| Finding | |
|---|---|
| Multi-select combo box is listed as supporting the property, but its chips and input stay top-aligned in the taller field | |
| 📐 | The new maxRows JSDoc note was not synced to the mixin's .d.ts |
📐 The new maxRows JSDoc note was not synced to the mixin's .d.ts
CONVENTIONS.md: "Any change in JSDoc descriptions in .js modules needs to be synced to the sibling hand-maintained .d.ts module." The note about --vaadin-input-field-height was added only to vaadin-text-area-mixin.js; the maxRows doc block in the .d.ts still has the old text.
vaadin-text-area-mixin.d.ts:76 · conventions
| * | `--vaadin-input-field-error-font-weight` | | ||
| * | `--vaadin-input-field-error-line-height` | | ||
| * | `--vaadin-input-field-gap` | | ||
| * | `--vaadin-input-field-height` | |
There was a problem hiding this comment.
The container's #wrapper (holding the prefix, chips and input) has align-self: start, so it keeps its content height while the host grows to the new min-height. The suffix (toggle button) is still centered by align-items: center, so the field renders with the value glued to the top and the button in the middle.
This does not show up in Lumo, where the property is applied to the slotted content instead, and the dev page used for verification has no multi-select combo box on it. Combo box, date picker, time picker and select all center correctly; only this component needs the wrapper to stretch (or center) when the host is taller than its content.
vaadin-multi-select-combo-box.js:103 · correctness
There was a problem hiding this comment.
IMO this needs its own follow-up decision. Changing align-self: start breaks "auto expand height" screenshot, and I would prefer to not ship behavior altering changes as part of a feature PR.
cc5c4d0 to
88d6c5f
Compare
Fixed. |
|
I feel we might want to wait for #12576, so that we can get the baseline alignment working accordingly. I don't think we need to rush this change, and fix the alignment here, as I believe it might get fixed by that PR. |
Sounds good to me. Converted this to draft for now. Let's get back to this after the baseline fix lands. |
Apply the property as a minimum height on the input container in base styles so that it also works with Aura, in addition to Lumo. There is no default value: the height is defined by the content and the padding unless the property is set. See #12546 for the decision on min-height semantics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
88d6c5f to
aace960
Compare
|
|
@jouni rebased this PR now when the baseline fix is merged. PTAL so we could include it in the next 25.3 beta. |
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 1 comment.
| Finding | |
|---|---|
| 📝 | The baseline-alignment caveat of the new property is only written down in the PR description |
| :host { | ||
| display: flex; | ||
| align-items: center; | ||
| min-height: var(--vaadin-input-field-height, auto); |
There was a problem hiding this comment.
📝 The baseline-alignment caveat of the new property is only written down in the PR description
With base styles / Aura, the field's baseline guide (:host::before in field-base-styles.js) keeps using 1lh + padding + border, so a field made taller by the property misaligns with adjacent text in a baseline-aligned row by half the extra height. Lumo does not have this problem because its :host::before height already resolves --vaadin-input-field-height.
The PR description covers this and names the workaround, but nothing a consumer can read does: the styling tables only list the property name, and --vaadin-field-baseline-input-height — the property the workaround relies on — appears in no styling table at all. A Note, paragraph in the field JSDoc (next to the existing input-prevented note) would carry it, together with documenting the escape hatch.
vaadin-input-container-base-styles.js:13 · documentation
There was a problem hiding this comment.
IMO let's not document --vaadin-field-baseline-input-height property, as it's internal.
There was a problem hiding this comment.
Possible follow-up for baseline: feat/input-field-height-property...proto/baseline-guide
There was a problem hiding this comment.
No one should need to fiddle with --vaadin-field-baseline-input-height, but it is there as an escape hatch if the calculations don't work and alignment is off by some pixels.



Description
Fixes #12546
Used
min-heightas agreed in #12546 (comment) to not break text-area and MSCB withautoExpandVertically.--vaadin-input-field-heightasmin-heighton thevaadin-input-containerhost in base styles, so the property now works with base styles and Aura, in addition to Lumo.jsand.d.ts) of components where it is applicablemaxRowsJSDoc oftext-areathat the property is applied as a minimum height and takes priority over themax-heightgiven bymaxRowsminRows/maxRowsinterplay) and visual tests forinput-container,text-field,password-field,number-fieldand single-rowtext-areadev/baseline.htmlType of change
How to test
dev/baseline.htmlNote
When the property makes a field taller than its content, the input text is centered in the field but the field's baseline alignment guide still assumes the content height, so baseline-aligned rows (e.g.
vaadin-horizontal-layoutwithalign-items: baseline) drift by half the difference. This is a known follow-up. Until then, set--vaadin-field-baseline-input-heighttocalc((<field height> + <content height>) / 2)on the affectedvaadin-text-field/vaadin-selectetc. elements themselves, not on:root: text-area, multi-select-combo-box and slider keep their content at the top and would be misaligned by a global value.🤖 Generated with Claude Code