Skip to content

Commit

Permalink
fix(material/form-field): account in cols attribute on textarea
Browse files Browse the repository at this point in the history
previously we were setting width of 180px on our input field however this also made that textarea width stays the same if they are used with `cols` attribute, this commit ensures we dont do that if we have a textarea with `cols` attribute allowing it to grow in width as much as the attribute wants it to

fixes angular#29459
  • Loading branch information
naaajii committed Oct 6, 2024
1 parent 984723e commit 5b23f3e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/material/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,14 @@ $_icon-prefix-infix-padding: 4px;
flex: auto;
min-width: 0;

// Infix stretches to fit the container, but naturally wants to be this wide. We set
// this in order to have a consistent natural size for the various types of controls
// that can go in a form field.
width: 180px;
// We do not to set fixed width on textarea with cols attribute as it makes different columns
// attribute look same width.
:has(:not(textarea[cols])) {
// Infix stretches to fit the container, but naturally wants to be this wide. We set
// this in order to have a consistent natural size for the various types of controls
// that can go in a form field.
width: 180px;
}

// Needed so that the floating label does not overlap with prefixes or suffixes.
position: relative;
Expand Down

0 comments on commit 5b23f3e

Please sign in to comment.