+
+ Default
+ Danger
+ Subtle
+ Subtle danger
+
+
+
+ Default
+ Danger
+ Subtle
+ Subtle danger
+
+
+
+ Default
+ Danger
+ Subtle
+ Subtle danger
+
+
+ `,
+ config
+ );
+
+ const container = page.locator('.container');
+
+ await expect(container).toHaveScreenshot(screenshot(`router-link-states`));
+ });
+ });
+});
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Chrome-linux.png
new file mode 100644
index 00000000000..5bb77a506c7
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Chrome-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Firefox-linux.png
new file mode 100644
index 00000000000..0b61eb607c0
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Firefox-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Safari-linux.png
new file mode 100644
index 00000000000..a5481e13cbc
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ionic-md-ltr-light-Mobile-Safari-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Chrome-linux.png
new file mode 100644
index 00000000000..e4a4c6e846e
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Chrome-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Firefox-linux.png
new file mode 100644
index 00000000000..a09707c0f4a
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Firefox-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Safari-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Safari-linux.png
new file mode 100644
index 00000000000..ed4b532a075
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-ios-ltr-Mobile-Safari-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Chrome-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Chrome-linux.png
new file mode 100644
index 00000000000..73756b56bfd
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Chrome-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Firefox-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Firefox-linux.png
new file mode 100644
index 00000000000..962a67d228c
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Firefox-linux.png differ
diff --git a/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Safari-linux.png b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Safari-linux.png
new file mode 100644
index 00000000000..fcfc9c7d9fd
Binary files /dev/null and b/core/src/components/router-link/test/states/router-link.e2e.ts-snapshots/router-link-states-md-ltr-Mobile-Safari-linux.png differ
diff --git a/core/src/themes/ionic/default.tokens.ts b/core/src/themes/ionic/default.tokens.ts
index 85e39f3eee6..f9865f28cfd 100644
--- a/core/src/themes/ionic/default.tokens.ts
+++ b/core/src/themes/ionic/default.tokens.ts
@@ -925,10 +925,18 @@ export const defaultTheme: DefaultTheme = {
IonRouterLink: {
hue: {
bold: {
+ activated: {
+ color: '#09358a',
+ },
+
default: {
color: ionColor('primary', 'foreground'),
},
+ visited: {
+ color: '#09358a',
+ },
+
semantic: {
default: {
color: currentColor('foreground'),
@@ -937,10 +945,18 @@ export const defaultTheme: DefaultTheme = {
},
subtle: {
+ activated: {
+ color: '#09358a',
+ },
+
default: {
color: ionColor('primary', 'foreground', { subtle: true }),
},
+ visited: {
+ color: '#09358a',
+ },
+
semantic: {
default: {
color: currentColor('foreground', { subtle: true }),
@@ -948,6 +964,35 @@ export const defaultTheme: DefaultTheme = {
},
},
},
+
+ state: {
+ activated: {
+ text: {
+ decoration: 'underline',
+ },
+ },
+
+ focus: {
+ border: {
+ radius: 'var(--ion-radii-sm)',
+ },
+
+ // The ring hugs the text at the sides and its line box above and below
+ padding: {
+ top: 'var(--ion-spacing-xxxs)',
+ end: 'var(--ion-spacing-0)',
+ bottom: 'var(--ion-spacing-xxxs)',
+ start: 'var(--ion-spacing-0)',
+ },
+
+ ring: {
+ color: '#b5c0f7',
+ offset: 'var(--ion-spacing-0)',
+ style: 'solid',
+ width: 'var(--ion-border-width-xxs)',
+ },
+ },
+ },
},
IonRow: {
diff --git a/core/src/themes/ios/default.tokens.ts b/core/src/themes/ios/default.tokens.ts
index a3fb9bf1fb5..d86d7acfc60 100644
--- a/core/src/themes/ios/default.tokens.ts
+++ b/core/src/themes/ios/default.tokens.ts
@@ -961,10 +961,18 @@ export const defaultTheme: DefaultTheme = {
color: ionColor('primary', 'foreground'),
},
+ focus: {
+ background: ionColor('primary', 'base', { alpha: 0.1 }),
+ },
+
semantic: {
default: {
color: currentColor('foreground'),
},
+
+ focus: {
+ background: currentColor('base', { alpha: 0.1 }),
+ },
},
},
@@ -973,10 +981,33 @@ export const defaultTheme: DefaultTheme = {
color: ionColor('primary', 'foreground', { subtle: true }),
},
+ focus: {
+ background: ionColor('primary', 'base', { alpha: 0.1 }),
+ },
+
semantic: {
default: {
color: currentColor('foreground', { subtle: true }),
},
+
+ focus: {
+ background: currentColor('base', { alpha: 0.1 }),
+ },
+ },
+ },
+ },
+
+ state: {
+ focus: {
+ border: {
+ radius: 'var(--ion-radii-xxs)',
+ },
+
+ padding: {
+ top: 'var(--ion-spacing-xxxs)',
+ end: 'var(--ion-spacing-xxs)',
+ bottom: 'var(--ion-spacing-xxxs)',
+ start: 'var(--ion-spacing-xxs)',
},
},
},
diff --git a/core/src/themes/md/default.tokens.ts b/core/src/themes/md/default.tokens.ts
index d39991aea7e..90b1861adb8 100644
--- a/core/src/themes/md/default.tokens.ts
+++ b/core/src/themes/md/default.tokens.ts
@@ -1077,10 +1077,18 @@ export const defaultTheme: DefaultTheme = {
color: ionColor('primary', 'foreground'),
},
+ focus: {
+ background: ionColor('primary', 'base', { alpha: 0.12 }),
+ },
+
semantic: {
default: {
color: currentColor('foreground'),
},
+
+ focus: {
+ background: currentColor('base', { alpha: 0.12 }),
+ },
},
},
@@ -1089,10 +1097,33 @@ export const defaultTheme: DefaultTheme = {
color: ionColor('primary', 'foreground', { subtle: true }),
},
+ focus: {
+ background: ionColor('primary', 'base', { alpha: 0.12 }),
+ },
+
semantic: {
default: {
color: currentColor('foreground', { subtle: true }),
},
+
+ focus: {
+ background: currentColor('base', { alpha: 0.12 }),
+ },
+ },
+ },
+ },
+
+ state: {
+ focus: {
+ border: {
+ radius: 'var(--ion-radii-sm)',
+ },
+
+ padding: {
+ top: 'var(--ion-spacing-xxxs)',
+ end: 'var(--ion-spacing-xxs)',
+ bottom: 'var(--ion-spacing-xxxs)',
+ start: 'var(--ion-spacing-xxs)',
},
},
},
diff --git a/core/src/themes/mixins.scss b/core/src/themes/mixins.scss
index 7c64964f108..1406e3d37ed 100644
--- a/core/src/themes/mixins.scss
+++ b/core/src/themes/mixins.scss
@@ -617,6 +617,8 @@ $rtl-use-host-context: true !default;
}
// Mixin that applies focus styles to interactive elements.
+// `$offset` sets the space between the ring and the element. Without
+// it, `$addOffset` offsets the ring by its own width.
//
// Example:
//
@@ -626,13 +628,15 @@ $rtl-use-host-context: true !default;
// }
// ```
// --------------------------------------------------
-@mixin focused-state($width: null, $style: solid, $color: null, $addOffset: true) {
+@mixin focused-state($width: null, $style: solid, $color: null, $addOffset: true, $offset: null) {
@if $width == null or $color == null {
outline: none;
} @else {
outline: $width $style $color;
- @if $addOffset {
+ @if $offset != null {
+ outline-offset: $offset;
+ } @else if $addOffset {
outline-offset: $width;
}
}