Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions core/src/components/textarea/test/states/textarea.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,21 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
});
});
});

configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('focused'), () => {
test('should render focused textarea correctly', async ({ page }) => {
await page.setContent(
`
<div class="container ion-padding">
<ion-textarea fill="outline" value="hi@ionic.io" class="has-focus"></ion-textarea>
</div>
`,
config
);

const container = page.locator('.container');
await expect(container).toHaveScreenshot(screenshot(`textarea-focused`));
});
});
});
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.
7 changes: 7 additions & 0 deletions core/src/components/textarea/textarea.ionic.outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@
:host(.textarea-fill-outline) textarea {
margin-top: globals.$ion-space-100;
}

// Input Focus
// ----------------------------------------------------------------

:host(.textarea-fill-outline.has-focus) {
--border-width: #{globals.$ion-border-size-050};
}
34 changes: 34 additions & 0 deletions core/src/components/textarea/textarea.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,37 @@ ion-icon {
.textarea-bottom .counter {
color: globals.$ion-primitives-neutral-800;
}

:host(.has-focus.ion-valid),
:host(.ion-touched.ion-invalid) {
--border-width: #{globals.$ion-border-size-025};
}

// Textarea Highlight
// ----------------------------------------------------------------

.textarea-highlight {
@include globals.position(null, null, -1px, 0);

position: absolute;

width: 100%;
height: globals.$ion-border-size-050;

transform: scale(0);

transition: transform globals.$ion-transition-time-200;

background: var(--border-color);
}

// Textarea Focus
// ----------------------------------------------------------------

:host(.has-focus) {
--border-color: #{globals.$ion-border-focus-default};
}

:host(.has-focus) .textarea-highlight {
transform: scale(1);
}
2 changes: 1 addition & 1 deletion core/src/components/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ export class Textarea implements ComponentInterface {
const shape = this.getShape();
const value = this.getValue();
const inItem = hostContext('ion-item', this.el);
const shouldRenderHighlight = theme === 'md' && fill !== 'outline' && !inItem;
const shouldRenderHighlight = (theme === 'md' || theme === 'ionic') && fill !== 'outline' && !inItem;

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