diff --git a/packages/fiori/src/SideNavigation.ts b/packages/fiori/src/SideNavigation.ts index 09e5c1391dd2..b3b7b898b36d 100644 --- a/packages/fiori/src/SideNavigation.ts +++ b/packages/fiori/src/SideNavigation.ts @@ -602,7 +602,7 @@ class SideNavigation extends UI5Element { } _selectItem(item: SideNavigationSelectableItemBase) { - if (item.disabled) { + if (item.disabled || !item.canBeSelected) { return; } diff --git a/packages/fiori/src/SideNavigationItem.ts b/packages/fiori/src/SideNavigationItem.ts index eca7a6fef1b2..3bff44985f45 100644 --- a/packages/fiori/src/SideNavigationItem.ts +++ b/packages/fiori/src/SideNavigationItem.ts @@ -213,6 +213,22 @@ class SideNavigationItem extends SideNavigationSelectableItemBase { get isSideNavigationItem() { return true; } + + _activate(e: KeyboardEvent | PointerEvent) { + super._activate(e); + + if (!this.canBeSelected) { + this.expanded = !this.expanded; + } + } + + get canBeSelected() { + if (this.items.length > 0 && !this.href) { + return false; + } + + return !this.isExternalLink; + } } SideNavigationItem.define(); diff --git a/packages/fiori/src/SideNavigationSelectableItemBase.ts b/packages/fiori/src/SideNavigationSelectableItemBase.ts index 4b47f1f6d353..6e1ed4714873 100644 --- a/packages/fiori/src/SideNavigationSelectableItemBase.ts +++ b/packages/fiori/src/SideNavigationSelectableItemBase.ts @@ -173,6 +173,10 @@ class SideNavigationSelectableItemBase extends SideNavigationItemBase { } } + get canBeSelected() { + return !this.isExternalLink; + } + get isSideNavigationSelectableItemBase() { return true; } diff --git a/packages/fiori/test/pages/NavigationLayout.html b/packages/fiori/test/pages/NavigationLayout.html index eea92e3d6b14..462cbb65745f 100644 --- a/packages/fiori/test/pages/NavigationLayout.html +++ b/packages/fiori/test/pages/NavigationLayout.html @@ -26,11 +26,11 @@ - + - +