fix(textarea): cols property is respected (#28081)

Issue number: resolves #22142

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Textarea always takes up the entire width of a line which prevents the
`cols` property from working correctly.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- The textarea respects the `col` property value only when `autoGrow` is
`false`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `7.3.2-dev.11693402720.1adb3bcf`

---------

Co-authored-by: ionitron <hi@ionicframework.com>
This commit is contained in:
Liam DeBeasi
2023-09-01 10:56:41 -04:00
committed by GitHub
parent 3086c9c1ad
commit 6d4eabcc10
10 changed files with 61 additions and 2 deletions

View File

@ -67,6 +67,22 @@
box-sizing: border-box;
}
/**
* When the cols property is set we should
* respect that width instead of defaulting
* to taking up the entire line.
* Requires both the cols and autoGrow
* properties to be reflected as attributes
* on the host.
*
* cols does not work with autoGrow because
* autoGrow would prevent line breaks from naturally
* occurring until the textarea takes up the entire line width.
*/
:host([cols]:not([auto-grow])) {
width: fit-content;
}
// TODO: FW-2876 - Remove this selector
:host(.legacy-textarea) {
flex: 1;