fix(textarea): support floating labels with slotted content - #31321
fix(textarea): support floating labels with slotted content#31321brandyscarney wants to merge 36 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| <slot name="start"></slot> | ||
| </div> | ||
| {hasOutlineFill && <div class="textarea-outline-container">{this.renderOutlineDecorations()}</div>} | ||
| <div class="textarea-start"> |
There was a problem hiding this comment.
I renamed the slot wrapper divs from the following:
start-slot-wrapper→textarea-startend-slot-wrapper→textarea-end
The goal was to align the naming with the wrapper elements added to Input.
This also matches our existing naming pattern with elements like input-bottom and textarea-bottom.
There was a problem hiding this comment.
I renamed these screenshots from textarea-slots to textarea-slot to match the folder name.
|
|
||
| configs().forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('textarea: start and end slots (visual checks)'), () => { | ||
| test.describe(title('textarea: slot'), () => { |
There was a problem hiding this comment.
This was updated to match the folder name, following how we title other tests.
| @@ -16,6 +16,10 @@ | |||
| --padding-start: 0px; | |||
| --highlight-height: 2px; | |||
|
|
|||
| // Setting the min-height to 72px enforces consistent heights | |||
| // across all label placements and fills. | |||
| min-height: 72px; | |||
There was a problem hiding this comment.
The rule this replaced set min-height: 56px for floating and stacked in the shared stylesheet, so putting the replacement only in the md file drops ios back to the base 44px.
Computed min-height on ios floating is 56px on major-9.0 and 44px here, and with rows="1" an ios floating textarea goes 98px to 74px. Should this live in the shared stylesheet instead? Either way it probably warrants a line in the breaking changes doc.
There was a problem hiding this comment.
I added the min-height: 56px back for ios: 014db57
I tried generating screenshots locally but saw no changes. Will see if the CI yells about it.
|
|
||
| **Minimum Height Change** | ||
|
|
||
| The minimum height of textarea in Material Design (`md` mode) has been increased from `56px` to `72px`. Textareas are now the same height regardless of the `fill` property or `labelPlacement`. If you were relying on textareas being `56px` tall or had custom CSS based on that value, update your styles for the new `72px` height or override it back to `56px`. |
There was a problem hiding this comment.
The 56px was only the floor for solid, outline and stacked/floating. Default fill with start, end or fixed sat on the shared 44px, so it's 44 to 72 there, and overriding back to 56px like this suggests leaves you taller than before.
Worth a word on rows too. On md start, rows="1" goes 44px to 72px and rows="2" 62px to 72px, so those two look the same now. ios changed as well and isn't mentioned.
There was a problem hiding this comment.
Updated breaking changes to mention the rows change: b5f498b
Also created a follow-up ticket to revisit this later.
thetaPC
left a comment
There was a problem hiding this comment.
LGTM, just minor docs: .textarea-wrapper-inner is still mentioned in docs/shadow-parts-guidelines.md.
| @@ -167,11 +240,147 @@ <h2>Outline / Autogrow</h2> | |||
| </div> | |||
| </div> | |||
|
|
|||
| <h1>Overflowing Slots</h1> | |||
There was a problem hiding this comment.
Same weird label rendering as input. Again, it can be a follow up.
There was a problem hiding this comment.
The label issue exists on main but I added it as a note for the follow-up ticket FW-7683.
For the shadow parts guidelines I made the update on Select since this seems to have been copied over from next where textarea is Shadow. I removed the notes about Textarea parts because it is still scoped on this branch: d2ded42
Issue number: N/A
What is the current behavior?
Textareas with a floating label and a start or end slot always display the label in the floated state, regardless of whether the textarea contains a value:
What is the new behavior?
mdspecification.Does this introduce a breaking change?
Floating Label Behavior
Floating labels no longer automatically float when the textarea contains slotted content. Labels float only when the textarea is focused or has a value.
Internal DOM Structure Changes
The internal DOM structure has been reorganized to support floating labels with slotted content.
Removed:
.textarea-wrapper-innerAdded:
.textarea-controlRenamed:
.start-slot-wrapper→.textarea-start.end-slot-wrapper→.textarea-endRestructured:
.label-text-wrappermoved from.textarea-wrapper-innerinto.textarea-control.native-wrappermoved from.textarea-wrapper-innerinto.textarea-control.start-slot-wrappermoved from.textarea-wrapper-innerto.textarea-wrapperand was renamed.textarea-start.end-slot-wrappermoved from.textarea-wrapper-innerto.textarea-wrapperand was renamed.textarea-endUpdate your selectors to account for these structural changes:
Minimum Height Change
The minimum height of textarea in Material Design (
mdmode) is now72px. At the default number of rows this makes textareas the same height regardless of thefillproperty orlabelPlacement. Previously the minimum height was:start,end,fixed44pxfloating,stacked56pxsolid,outline56pxThese were minimums, not the heights textareas actually rendered at. A textarea with content in the
startorendslots was already taller than its minimum, so the change affects it differently. For example, afill="solid"textarea with slotted icons and buttons previously rendered at72pxwith astartlabel and81pxwith afloatinglabel. Both are now72px, so that floating label case is9pxshorter than before rather than taller.Because
72pxis taller than two rows of text,rowsvalues below3no longer change the height of the textarea inmdmode:rows="1"androws="2"both render at72px.If you were relying on the previous heights, or you need
rowsto control the height, override the minimum height back. The override has to be more specific than the component's own style, so a bareion-textareaselector will not apply. Add a custom class to the textarea to increase specificity:Other information
Preview