diff --git a/core/src/components/chip/chip.scss b/core/src/components/chip/chip.scss
index bd26d6f50bd..7b2814cf651 100644
--- a/core/src/components/chip/chip.scss
+++ b/core/src/components/chip/chip.scss
@@ -195,11 +195,6 @@
color: var(--ion-chip-hue-bold-solid-default-color);
}
-// Default: Activated
-:host(.chip-hue-bold.chip-fill-solid.ion-activated) {
- background: var(--ion-chip-hue-bold-solid-activated-background, var(--ion-chip-hue-bold-solid-default-background));
-}
-
// Default: Focus
:host(.chip-hue-bold.chip-fill-solid.ion-focused) {
background: var(--ion-chip-hue-bold-solid-focus-background, var(--ion-chip-hue-bold-solid-default-background));
@@ -212,20 +207,17 @@
}
}
+// Default: Activated
+:host(.chip-hue-bold.chip-fill-solid.ion-activated) {
+ background: var(--ion-chip-hue-bold-solid-activated-background, var(--ion-chip-hue-bold-solid-default-background));
+}
+
// Colors
:host(.chip-hue-bold.chip-fill-solid.ion-color) {
background: var(--ion-chip-hue-bold-solid-semantic-default-background);
color: var(--ion-chip-hue-bold-solid-semantic-default-color);
}
-// Colors: Activated
-:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-activated) {
- background: var(
- --ion-chip-hue-bold-solid-semantic-activated-background,
- var(--ion-chip-hue-bold-solid-semantic-default-background)
- );
-}
-
// Colors: Focus
:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-focused) {
background: var(
@@ -244,6 +236,14 @@
}
}
+// Colors: Activated
+:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-activated) {
+ background: var(
+ --ion-chip-hue-bold-solid-semantic-activated-background,
+ var(--ion-chip-hue-bold-solid-semantic-default-background)
+ );
+}
+
// Chip: Bold Outline
// ---------------------------------------------
@@ -257,14 +257,6 @@
color: var(--ion-chip-hue-bold-outline-default-color);
}
-// Default: Activated
-:host(.chip-hue-bold.chip-fill-outline.ion-activated) {
- background: var(
- --ion-chip-hue-bold-outline-activated-background,
- var(--ion-chip-hue-bold-outline-default-background)
- );
-}
-
// Default: Focus
:host(.chip-hue-bold.chip-fill-outline.ion-focused) {
background: var(--ion-chip-hue-bold-outline-focus-background, var(--ion-chip-hue-bold-outline-default-background));
@@ -277,6 +269,14 @@
}
}
+// Default: Activated
+:host(.chip-hue-bold.chip-fill-outline.ion-activated) {
+ background: var(
+ --ion-chip-hue-bold-outline-activated-background,
+ var(--ion-chip-hue-bold-outline-default-background)
+ );
+}
+
// Colors
:host(.chip-hue-bold.chip-fill-outline.ion-color) {
border-width: var(--ion-chip-hue-bold-outline-semantic-default-border-width);
@@ -287,14 +287,6 @@
color: var(--ion-chip-hue-bold-outline-semantic-default-color);
}
-// Colors: Activated
-:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-activated) {
- background: var(
- --ion-chip-hue-bold-outline-semantic-activated-background,
- var(--ion-chip-hue-bold-outline-semantic-default-background)
- );
-}
-
// Colors: Focus
:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-focused) {
background: var(
@@ -313,6 +305,14 @@
}
}
+// Colors: Activated
+:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-activated) {
+ background: var(
+ --ion-chip-hue-bold-outline-semantic-activated-background,
+ var(--ion-chip-hue-bold-outline-semantic-default-background)
+ );
+}
+
// Chip: Subtle Solid
// ---------------------------------------------
@@ -322,14 +322,6 @@
color: var(--ion-chip-hue-subtle-solid-default-color);
}
-// Default: Activated
-:host(.chip-hue-subtle.chip-fill-solid.ion-activated) {
- background: var(
- --ion-chip-hue-subtle-solid-activated-background,
- var(--ion-chip-hue-subtle-solid-default-background)
- );
-}
-
// Default: Focus
:host(.chip-hue-subtle.chip-fill-solid.ion-focused) {
background: var(--ion-chip-hue-subtle-solid-focus-background, var(--ion-chip-hue-subtle-solid-default-background));
@@ -342,20 +334,20 @@
}
}
+// Default: Activated
+:host(.chip-hue-subtle.chip-fill-solid.ion-activated) {
+ background: var(
+ --ion-chip-hue-subtle-solid-activated-background,
+ var(--ion-chip-hue-subtle-solid-default-background)
+ );
+}
+
// Colors
:host(.chip-hue-subtle.chip-fill-solid.ion-color) {
background: var(--ion-chip-hue-subtle-solid-semantic-default-background);
color: var(--ion-chip-hue-subtle-solid-semantic-default-color);
}
-// Colors: Activated
-:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-activated) {
- background: var(
- --ion-chip-hue-subtle-solid-semantic-activated-background,
- var(--ion-chip-hue-subtle-solid-semantic-default-background)
- );
-}
-
// Colors: Focus
:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-focused) {
background: var(
@@ -374,6 +366,14 @@
}
}
+// Colors: Activated
+:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-activated) {
+ background: var(
+ --ion-chip-hue-subtle-solid-semantic-activated-background,
+ var(--ion-chip-hue-subtle-solid-semantic-default-background)
+ );
+}
+
// Chip: Subtle Outline
// ---------------------------------------------
@@ -387,14 +387,6 @@
color: var(--ion-chip-hue-subtle-outline-default-color);
}
-// Default: Activated
-:host(.chip-hue-subtle.chip-fill-outline.ion-activated) {
- background: var(
- --ion-chip-hue-subtle-outline-activated-background,
- var(--ion-chip-hue-subtle-outline-default-background)
- );
-}
-
// Default: Focus
:host(.chip-hue-subtle.chip-fill-outline.ion-focused) {
background: var(
@@ -413,6 +405,14 @@
}
}
+// Default: Activated
+:host(.chip-hue-subtle.chip-fill-outline.ion-activated) {
+ background: var(
+ --ion-chip-hue-subtle-outline-activated-background,
+ var(--ion-chip-hue-subtle-outline-default-background)
+ );
+}
+
// Colors
:host(.chip-hue-subtle.chip-fill-outline.ion-color) {
border-width: var(--ion-chip-hue-subtle-outline-semantic-default-border-width);
@@ -423,14 +423,6 @@
color: var(--ion-chip-hue-subtle-outline-semantic-default-color);
}
-// Colors: Activated
-:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-activated) {
- background: var(
- --ion-chip-hue-subtle-outline-semantic-activated-background,
- var(--ion-chip-hue-subtle-outline-semantic-default-background)
- );
-}
-
// Colors: Focus
:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-focused) {
background: var(
@@ -449,6 +441,14 @@
}
}
+// Colors: Activated
+:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-activated) {
+ background: var(
+ --ion-chip-hue-subtle-outline-semantic-activated-background,
+ var(--ion-chip-hue-subtle-outline-semantic-default-background)
+ );
+}
+
// Chip States
// ---------------------------------------------
diff --git a/core/src/components/chip/test/states/chip.e2e.ts b/core/src/components/chip/test/states/chip.e2e.ts
index 0e518a612cf..5476a4c4799 100644
--- a/core/src/components/chip/test/states/chip.e2e.ts
+++ b/core/src/components/chip/test/states/chip.e2e.ts
@@ -1,6 +1,9 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';
+import { HUES } from '../../../../themes/themes.interfaces';
+import { ION_CHIP_FILLS } from '../../chip.interface';
+
/**
* This behavior does not vary across directions.
*
@@ -90,3 +93,58 @@ configs({ modes: ['ios', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, s
});
});
});
+
+/**
+ * This behavior does not vary across modes or directions.
+ */
+configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, config }) => {
+ test.describe(title('chip: pressed state'), () => {
+ /**
+ * `(any-hover: hover)` evaluates to "none" when the browser reports a
+ * touch device, so turn that off to apply the hover rules. Headless
+ * Firefox reports no hover capability regardless, so it skips the test.
+ */
+ test.use({
+ hasTouch: false,
+ isMobile: false,
+ });
+
+ HUES.forEach((hue) => {
+ ION_CHIP_FILLS.forEach((fill) => {
+ ['', 'primary'].forEach((color) => {
+ test(`should show the activated background when pressing a hovered ${hue} ${fill} chip${
+ color ? ` with a color` : ''
+ }`, async ({ page, skip }) => {
+ skip.browser('firefox', 'Headless Firefox reports no hover capability');
+
+ const prefix = `--ion-chip-hue-${hue}-${fill}${color ? '-semantic' : ''}`;
+
+ await page.setContent(
+ `
+
+
+
+ Chip
+
+ `,
+ config
+ );
+
+ const chip = page.locator('ion-chip');
+
+ await chip.hover();
+ await chip.evaluate((el) => el.classList.add('ion-activated'));
+ await page.waitForChanges();
+
+ await expect(chip).toHaveCSS('background-color', 'rgb(0, 0, 255)');
+ });
+ });
+ });
+ });
+ });
+});