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
6 changes: 4 additions & 2 deletions core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@
background-color: transparent;
background-repeat: no-repeat;

color: $text-color-step-400;

visibility: hidden;
appearance: none;
}

.input-clear-icon ion-icon {
color: $text-color-step-400;
:host(.in-item-color) .input-clear-icon {
color: inherit;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
} from '../../interface';
import type { Attributes } from '../../utils/helpers';
import { inheritAriaAttributes, debounceEvent, findItemLabel, inheritAttributes } from '../../utils/helpers';
import { createColorClasses } from '../../utils/theme';
import { createColorClasses, hostContext } from '../../utils/theme';

/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
Expand Down Expand Up @@ -454,6 +454,7 @@ export class Input implements ComponentInterface {
[mode]: true,
'has-value': this.hasValue(),
'has-focus': this.hasFocus,
'in-item-color': hostContext('ion-item.ion-color', this.el),
})}
>
<input
Expand Down
15 changes: 14 additions & 1 deletion core/src/components/input/test/basic/input.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test.describe('input: clear button', () => {
*/
test('should keep the input focused when the clear button is pressed', async ({ page }) => {
await page.setContent(`
<ion-input value="abc" clear-input="true"></ion-searchbar>
<ion-input value="abc" clear-input="true"></ion-input>
`);

const input = page.locator('ion-input');
Expand All @@ -200,4 +200,17 @@ test.describe('input: clear button', () => {

await expect(nativeInput).toBeFocused();
});

test('should inherit color when used in item with color property', async ({ page }) => {
await page.setContent(`
<ion-item color="primary">
<ion-input value="Text" clear-input="true"></ion-input>
</ion-item>
`);

const item = page.locator('ion-item');
expect(await item.screenshot()).toMatchSnapshot(
`input-with-clear-button-item-color-${page.getSnapshotSettings()}.png`
);
});
});
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.