Skip to content

Commit 859c4df

Browse files
Fix searchbar colors + hide clear button when searchbar is disabled + tests
1 parent b71f442 commit 859c4df

File tree

43 files changed

+36
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+36
-7
lines changed

core/src/components/searchbar/searchbar.ionic.scss

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* @prop --focus-ring-color: The color of the ring around the focused element.
1010
* @prop --focus-ring-width: The width of the ring around the focused element.
1111
*/
12-
--background: #{globals.$ion-primitives-neutral-100};
12+
--background: #{globals.$ion-bg-neutral-subtle-default};
1313
--border-radius: #{globals.$ion-border-radius-400};
1414
--box-shadow: none;
1515
--cancel-button-color: #{globals.$ion-primitives-neutral-800};
1616
--clear-button-color: #{globals.$ion-primitives-neutral-1000};
1717
--color: #{globals.$ion-primitives-neutral-1200};
18-
--icon-color: #{globals.$ion-primitives-neutral-800};
19-
--placeholder-color: #{globals.$ion-primitives-neutral-800};
18+
--icon-color: #{globals.$ion-icon-default};
19+
--placeholder-color: #{globals.$ion-text-subtlest};
2020
--focus-ring-color: #{globals.$ion-border-focus-default};
2121
--focus-ring-width: #{globals.$ion-border-size-050};
2222
--leading-icon-padding: #{calc(globals.$ion-scale-400 + globals.$ion-space-200)};
@@ -105,6 +105,10 @@
105105
--leading-icon-padding: #{globals.$ion-scale-0};
106106
}
107107

108+
:host(:not(.searchbar-has-value)) {
109+
--icon-color: #{globals.$ion-icon-subtlest};
110+
}
111+
108112
// Searchbar in Toolbar
109113
// -----------------------------------------
110114

@@ -156,8 +160,8 @@
156160
/* Disabled */
157161
:host(.searchbar-disabled) {
158162
--color: #{globals.$ion-primitives-neutral-500};
159-
--icon-color: #{globals.$ion-primitives-neutral-500};
160-
--placeholder-color: #{globals.$ion-primitives-neutral-500};
163+
--icon-color: #{globals.$ion-icon-disabled};
164+
--placeholder-color: #{globals.$ion-text-disabled};
161165

162166
cursor: default;
163167
pointer-events: none;

core/src/components/searchbar/searchbar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,10 @@ export class Searchbar implements ComponentInterface {
626626
return false;
627627
}
628628

629+
if (getIonTheme(this) === 'ionic' && this.disabled) {
630+
return false;
631+
}
632+
629633
return true;
630634
}
631635

core/src/components/searchbar/test/basic/searchbar.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
158158
});
159159
});
160160

161-
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
162-
test.describe(title('searchbar: ios clear button text cut off'), () => {
161+
configs({ modes: ['ios', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
162+
test.describe(title('searchbar: clear button text cut off'), () => {
163163
test('text should not be cut off when clear button is hidden', async ({ page }) => {
164164
await page.setContent(
165165
`
-216 Bytes
-211 Bytes
-257 Bytes
-220 Bytes
-208 Bytes
-250 Bytes

0 commit comments

Comments
 (0)