Skip to content

Commit 5907566

Browse files
committed
feat(Item): Update canActivate logic to consider theme and mode
1 parent 682e25d commit 5907566

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/components/item/item.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createColorClasses, hostContext, openURL } from '@utils/theme';
88
import { chevronForward } from 'ionicons/icons';
99

1010
import { config } from '../../global/config';
11-
import { getIonTheme } from '../../global/ionic-global';
11+
import { getIonMode, getIonTheme } from '../../global/ionic-global';
1212
import type { AnimationBuilder, Color, CssClassMap, StyleEventDetail } from '../../interface';
1313
import type { RouterDirection } from '../router/utils/interface';
1414

@@ -246,7 +246,13 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
246246
}
247247

248248
private canActivate(): boolean {
249-
return this.isClickable() || this.hasCover();
249+
const theme = getIonTheme(this);
250+
const mode = getIonMode(this);
251+
const shouldActivate = this.isClickable() || this.hasCover();
252+
if (theme !== 'ionic') {
253+
return shouldActivate;
254+
}
255+
return mode === 'md' && shouldActivate;
250256
}
251257

252258
private isFocusable(): boolean {

0 commit comments

Comments
 (0)