Skip to content

Commit 6f11bde

Browse files
committed
fix highlight and focus on textarea with ionic theme
1 parent e16c633 commit 6f11bde

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@
5959
:host(.textarea-fill-outline) textarea {
6060
margin-top: globals.$ion-space-100;
6161
}
62+
63+
// Input Focus
64+
// ----------------------------------------------------------------
65+
66+
:host(.textarea-fill-outline.has-focus) {
67+
--border-width: #{globals.$ion-border-size-050};
68+
}

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,38 @@ ion-icon {
132132
.textarea-bottom .counter {
133133
color: globals.$ion-primitives-neutral-800;
134134
}
135+
136+
:host(.has-focus.ion-valid),
137+
:host(.ion-touched.ion-invalid) {
138+
--border-width: #{globals.$ion-border-size-025};
139+
}
140+
141+
142+
// Textarea Highlight
143+
// ----------------------------------------------------------------
144+
145+
.textarea-highlight {
146+
@include globals.position(null, null, -1px, 0);
147+
148+
position: absolute;
149+
150+
width: 100%;
151+
height: globals.$ion-border-size-050;
152+
153+
transform: scale(0);
154+
155+
transition: transform 200ms;
156+
157+
background: var(--border-color);
158+
}
159+
160+
// Textarea Focus
161+
// ----------------------------------------------------------------
162+
163+
:host(.has-focus) {
164+
--border-color: #{globals.$ion-border-focus-default};
165+
}
166+
167+
:host(.has-focus) .textarea-highlight {
168+
transform: scale(1);
169+
}

core/src/components/textarea/textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ export class Textarea implements ComponentInterface {
670670
const shape = this.getShape();
671671
const value = this.getValue();
672672
const inItem = hostContext('ion-item', this.el);
673-
const shouldRenderHighlight = theme === 'md' && fill !== 'outline' && !inItem;
673+
const shouldRenderHighlight = (theme === 'md' || theme === 'ionic') && fill !== 'outline' && !inItem;
674674

675675
const hasValue = this.hasValue();
676676
const hasStartEndSlots = el.querySelector('[slot="start"], [slot="end"]') !== null;

0 commit comments

Comments
 (0)