Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8e44a84
Adding half row height to textarea wrapper
rugoncalves Feb 16, 2026
6d2cf2f
Adding tests
rugoncalves Feb 16, 2026
be69a19
Trying out to increase height differently
rugoncalves Feb 16, 2026
ed3e0d3
Change labels in tests
rugoncalves Feb 16, 2026
98c4643
Adding paddings
rugoncalves Feb 16, 2026
8d105ba
chore(): add updated snapshots
Ionitron Feb 16, 2026
06dba03
Fixing the visual tests
rugoncalves Feb 16, 2026
1002e0a
chore(): add updated snapshots
Ionitron Feb 16, 2026
00b375b
Specifying when height should be 0
rugoncalves Feb 16, 2026
3c2ae2f
chore(): add updated snapshots
Ionitron Feb 16, 2026
dbbde87
Removing setting height = 0
rugoncalves Feb 16, 2026
a64bba9
chore(): add updated snapshots
Ionitron Feb 16, 2026
682c40f
Re-adding the height: 0
rugoncalves Feb 16, 2026
d17e70c
Enforcing respect over row parameter
rugoncalves Feb 16, 2026
4f4283a
Fix on the height
rugoncalves Feb 16, 2026
388c87b
chore(): add updated snapshots
Ionitron Feb 16, 2026
fe037ef
Removing extra leading space
rugoncalves Feb 16, 2026
7780e6d
Merge branch 'ROU-12443-v4' of https://github.com/ionic-team/ionic-fr…
rugoncalves Feb 16, 2026
8390653
Removing forced height
rugoncalves Feb 16, 2026
75b34a5
chore(): add updated snapshots
Ionitron Feb 16, 2026
10cbe31
Fix lint
rugoncalves Feb 16, 2026
5b8a456
Merge branch 'ROU-12443-v4' of https://github.com/ionic-team/ionic-fr…
rugoncalves Feb 16, 2026
0deda70
Update comments
rugoncalves Feb 18, 2026
d864510
Changing test name
rugoncalves Feb 18, 2026
c8c1fb1
Removing property label-placement from tests
rugoncalves Feb 18, 2026
f833b25
Removing property helper-text from tests
rugoncalves Feb 18, 2026
373f66a
Improving consistency
rugoncalves Feb 18, 2026
527fac6
Fix test missing quote
rugoncalves Feb 18, 2026
e05db9f
Reviewing the order of the css in ionic theme
rugoncalves Feb 18, 2026
5f0075a
Improved comment
rugoncalves Feb 18, 2026
56a5638
Remove old screenshots
rugoncalves Feb 18, 2026
d460dcc
Adding test with icon in the start and end slots
rugoncalves Feb 18, 2026
3fb17c6
Removing test for fill outline and solid
rugoncalves Feb 18, 2026
b68a30e
Simplifying tests for rows
rugoncalves Feb 18, 2026
7866bb3
Update core/src/components/textarea/textarea.common.scss
rugoncalves Feb 18, 2026
8b5def6
Removing unneeded margin
rugoncalves Feb 18, 2026
c39f687
Merge branch 'ROU-12443-v4' of https://github.com/ionic-team/ionic-fr…
rugoncalves Feb 18, 2026
27412d7
chore(): add updated snapshots
Ionitron Feb 18, 2026
e98eeb4
Merge branch 'ROU-12443-v4' of https://github.com/ionic-team/ionic-fr…
rugoncalves Feb 18, 2026
8913885
chore(): add updated snapshots
Ionitron Feb 18, 2026
ce3a0a8
Changes requested for tests
rugoncalves Feb 18, 2026
6966803
Remove screenshots
rugoncalves Feb 18, 2026
a95083b
Reverting test name change
rugoncalves Feb 18, 2026
cad746a
chore(): add updated snapshots
Ionitron Feb 18, 2026
787dadf
test(textarea): change text from small
thetaPC Feb 18, 2026
bc31434
test(textarea): change text from medium
thetaPC Feb 18, 2026
afe5120
test(textarea): change text from large
thetaPC Feb 18, 2026
7fa136f
chore(): add updated snapshots
Ionitron Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions core/src/components/textarea/test/rows/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Textarea - Rows</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
<script src="../../../../../scripts/testing/scripts.js"></script>
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
<style>
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(250px, 1fr));
grid-row-gap: 20px;
grid-column-gap: 20px;
}

h2 {
font-size: 12px;
font-weight: normal;
color: #6f7378;
margin-top: 10px;
}

@media screen and (max-width: 800px) {
.grid {
grid-template-columns: 1fr;
padding: 0;
}
}
</style>
</head>

<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Textarea - Rows</ion-title>
</ion-toolbar>
</ion-header>

<ion-content id="content" class="ion-padding">
<div class="grid">
<div class="grid-item">
<h2>Rows: 3</h2>
<ion-textarea
rows="3"
label="Comments"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 2</h2>
<ion-textarea
rows="2"
label="Text Area"
label-placement="stacked"
helper-text="rows=2, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 5</h2>
<ion-textarea
rows="5"
label="Text Area"
label-placement="stacked"
helper-text="rows=5, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 8</h2>
<ion-textarea
rows="8"
label="Text Area"
label-placement="stacked"
helper-text="rows=8, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 3, Size Small</h2>
<ion-textarea
rows="3"
size="small"
label="Small Size"
label-placement="stacked"
helper-text="rows=3, size=small, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 3, Size Medium</h2>
<ion-textarea
rows="3"
size="medium"
label="Medium Size"
label-placement="stacked"
helper-text="rows=3, size=medium, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 3, Size Large</h2>
<ion-textarea
rows="3"
size="large"
label="Large Size"
label-placement="stacked"
helper-text="rows=3, size=large, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>

<div class="grid-item">
<h2>Rows: 3, Auto-grow</h2>
<ion-textarea
rows="3"
auto-grow="true"
label="Comments"
label-placement="stacked"
helper-text="rows=3, auto-grow=true, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>
</div>
</ion-content>
</ion-app>
</body>
</html>
207 changes: 207 additions & 0 deletions core/src/components/textarea/test/rows/textarea.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* Rows attribute is only available in the Ionic theme.
* When set, it increases the container min-height to accommodate the number of rows.
*/
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('textarea: rows'), () => {
test('should respect rows attribute and set min-height', async ({ page }) => {
await page.setContent(
`
<ion-textarea
rows="3"
label="Comments"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-rows-3`));
});

test('should respect rows attribute with different values', async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test as it's just a duplicate of the first test. Make sure to delete the old snapshots too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the decision made above, this should be or not removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's still remove this test and update should respect rows attribute to have rows 1, 3, and 8 with no size attribute.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the changes requested and done to the tests, this is no longer applicable.

await page.setContent(
`
<div id="container" style="display: flex; flex-direction: column; gap: 20px;">
<ion-textarea
rows="1"
label="Small"
label-placement="stacked"
helper-text="rows=1, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="1"
label="Medium"
label-placement="stacked"
helper-text="rows=1, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="1"
label="Large"
label-placement="stacked"
helper-text="rows=1, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="3"
label="Small"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="3"
label="Medium"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="3"
label="Large"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="5"
label="Small"
label-placement="stacked"
helper-text="rows=5, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="5"
label="Medium"
label-placement="stacked"
helper-text="rows=5, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="5"
label="Large"
label-placement="stacked"
helper-text="rows=5, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>
`,
config
);

const container = page.locator('#container');
await expect(container).toHaveScreenshot(screenshot(`textarea-rows-different-values`));
});

test('should respect rows attribute with fill outline and solid', async ({ page }) => {
await page.setContent(
`
<div id="container" style="display: flex; flex-direction: column; gap: 20px;">
<ion-textarea
rows="4"
fill="outline"
label="Outline"
label-placement="stacked"
helper-text="rows=4, fill=outline, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="4"
fill="solid"
label="Solid"
label-placement="stacked"
helper-text="rows=4, fill=solid, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>
`,
config
);

const container = page.locator('#container');
await expect(container).toHaveScreenshot(screenshot(`textarea-rows-4-fill`));
});

test('should respect rows attribute with different sizes', async ({ page }) => {
await page.setContent(
`
<div id="container" style="display: flex; flex-direction: column; gap: 20px;">
<ion-textarea
rows="3"
size="small"
label="Small Size"
label-placement="stacked"
helper-text="rows=3, size=small, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="3"
size="medium"
label="Medium Size"
label-placement="stacked"
helper-text="rows=3, size=medium, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
<ion-textarea
rows="3"
size="large"
label="Large Size"
label-placement="stacked"
helper-text="rows=3, size=large, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
</div>
`,
config
);

const container = page.locator('#container');
await expect(container).toHaveScreenshot(screenshot(`textarea-rows-different-sizes`));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await expect(container).toHaveScreenshot(screenshot(`textarea-rows-different-sizes`));
await expect(container).toHaveScreenshot(screenshot(`textarea-rows-sizes`));

Make sure to delete the old snapshots too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the decision made above, this should be or not removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be removed, the request is to change the file name. By changing the file name, the old snapshots will still be there so those are the ones that will be deleted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the changes requested and done to the tests, this is no longer applicable.

});

test('should respect rows attribute with value content', async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this test since it's the same as the first one. Make sure to delete the old snapshots too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the decision made above, this should be or not removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should still be removed as it's a duplicate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the changes requested and done to the tests, this is no longer applicable.

await page.setContent(
`
<ion-textarea
rows="3"
label="Comments"
label-placement="stacked"
helper-text="rows=3, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-rows-3-with-value`));
});

test('should respect rows when auto-grow is enabled', async ({ page }) => {
await page.setContent(
`
<ion-textarea
rows="3"
auto-grow="true"
label="Comments"
label-placement="stacked"
helper-text="rows=3, auto-grow=true, label-placement=stacked"
value="1&#10;2&#10;3&#10;4&#10;5&#10;6&#10;7&#10;8&#10;9&#10;0"
></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-rows-3-autogrow`));
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions core/src/components/textarea/textarea.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,18 @@
opacity: 1;
}

/**
* When the rows attribute is set, the textarea should not force a min-height,
* but rather respect the natural height of the textarea, especially when
* rows is set to 1.
*/
:host(.textarea-fill-solid[rows]),
:host(.textarea-fill-outline[rows]),
:host(.textarea-label-placement-stacked[rows]),
:host(.textarea-label-placement-floating[rows]) {
min-height: auto;
}

// Start / End Slots
// ----------------------------------------------------------------

Expand Down
Loading
Loading