Skip to content

Commit 0617123

Browse files
fix(textarea): update disabled and readonly to match ionic theme (#30187)
Issue number: internal --------- <!-- 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. --> - There was a misalignment between the disabled and readonly state textarea with the desired designed UX. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - update textarea css vars; - add styles for disabled textarea; - add styles for readonly textarea; ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> [textarea preview](https://ionic-framework-git-rou-11586-ionic1.vercel.app/src/components/textarea/test/basic?ionic:theme=ionic) --------- Co-authored-by: Maria Hutt <[email protected]>
1 parent ae78967 commit 0617123

9 files changed

+38
-4
lines changed

core/src/components/textarea/test/states/textarea.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4-
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
4+
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
55
test.describe(title('textarea: states'), () => {
66
test('should render readonly textarea correctly', async ({ page }) => {
77
await page.setContent(
2.67 KB
Loading
3.95 KB
Loading
2.7 KB
Loading
2.92 KB
Loading
4.25 KB
Loading
2.99 KB
Loading

core/src/components/textarea/textarea.ionic.scss

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
// --------------------------------------------------
77

88
:host {
9+
--border-color: #{globals.$ion-primitives-neutral-500};
910
--color: #{globals.$ion-primitives-neutral-1200};
10-
--highlight-color-valid: #{globals.$ion-semantics-success-base};
11-
--highlight-color-invalid: #{globals.$ion-semantics-danger-base};
11+
--highlight-color-valid: #{globals.$ion-semantics-success-900};
12+
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
1213
--placeholder-color: #{globals.$ion-primitives-neutral-800};
1314
--placeholder-opacity: 1;
1415
--background: #{globals.$ion-primitives-base-white};
@@ -166,3 +167,35 @@ ion-icon {
166167
:host(.has-focus) .textarea-highlight {
167168
transform: scale(1);
168169
}
170+
171+
// Textarea Hover
172+
// ----------------------------------------------------------------
173+
174+
@media (any-hover: hover) {
175+
:host(:hover) {
176+
--border-color: #{globals.$ion-primitives-neutral-600};
177+
}
178+
}
179+
180+
// Textarea - Disabled
181+
// ----------------------------------------------------------------
182+
183+
:host(.textarea-disabled) {
184+
--color: #{globals.$ion-primitives-neutral-500};
185+
--background: #{globals.$ion-primitives-neutral-100};
186+
--border-color: #{globals.$ion-primitives-neutral-300};
187+
--placeholder-color: #{globals.$ion-primitives-neutral-500};
188+
}
189+
190+
:host(.textarea-disabled:not(.ion-valid)) .textarea-bottom .helper-text,
191+
:host(.textarea-disabled) .textarea-bottom .counter,
192+
:host(.textarea-disabled) .label-text-wrapper {
193+
color: globals.$ion-primitives-neutral-500;
194+
}
195+
196+
// Textarea - Readonly
197+
// ----------------------------------------------------------------
198+
199+
:host(.textarea-readonly) {
200+
--background: #{globals.$ion-primitives-neutral-100};
201+
}

core/src/components/textarea/textarea.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ export class Textarea implements ComponentInterface {
676676
}
677677

678678
render() {
679-
const { inputId, disabled, size, labelPlacement, el, hasFocus } = this;
679+
const { inputId, disabled, readonly, size, labelPlacement, el, hasFocus } = this;
680680
const fill = this.getFill();
681681
const theme = getIonTheme(this);
682682
const shape = this.getShape();
@@ -719,6 +719,7 @@ export class Textarea implements ComponentInterface {
719719
[`textarea-size-${size}`]: true,
720720
[`textarea-label-placement-${labelPlacement}`]: true,
721721
'textarea-disabled': disabled,
722+
'textarea-readonly': readonly,
722723
})}
723724
>
724725
{/**

0 commit comments

Comments
 (0)