From 0bf70af77d169fdef42c3b411b25c1bdeb74e3be Mon Sep 17 00:00:00 2001 From: Todor Stoyanov Date: Mon, 25 Nov 2024 13:59:25 +0200 Subject: [PATCH] feat(ui5-menu): fix comment --- packages/main/src/Menu.ts | 6 +----- packages/main/src/MenuItem.ts | 16 ++++------------ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/packages/main/src/Menu.ts b/packages/main/src/Menu.ts index 51ba09ce8db9..3e17005104e3 100644 --- a/packages/main/src/Menu.ts +++ b/packages/main/src/Menu.ts @@ -397,11 +397,7 @@ class Menu extends UI5Element { const currentIndex = this._menuItems.indexOf(menuItem); const nextItem = isNext ? this._menuItems[currentIndex + 1] : this._menuItems[currentIndex - 1]; - if (nextItem) { - nextItem.focus(); - } else { - this._menuItems[currentIndex].focus(); - } + !!nextItem ? nextItem.focus() : this._menuItems[currentIndex].focus(); } _beforePopoverOpen(e: CustomEvent) { diff --git a/packages/main/src/MenuItem.ts b/packages/main/src/MenuItem.ts index c727c33c2bee..53bad2ef24a4 100644 --- a/packages/main/src/MenuItem.ts +++ b/packages/main/src/MenuItem.ts @@ -8,15 +8,15 @@ import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types import "@ui5/webcomponents-icons/dist/nav-back.js"; import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; import type { ListItemAccessibilityAttributes } from "./ListItem.js"; -import ListItem from "./ListItem.js"; -import ResponsivePopover from "./ResponsivePopover.js"; -import type PopoverPlacement from "./types/PopoverPlacement.js"; import NavigationMode from "@ui5/webcomponents-base/dist/types/NavigationMode.js"; import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js"; import { isLeft, isRight, } from "@ui5/webcomponents-base/dist/Keys.js"; +import ListItem from "./ListItem.js"; +import ResponsivePopover from "./ResponsivePopover.js"; +import type PopoverPlacement from "./types/PopoverPlacement.js"; import List from "./List.js"; import Icon from "./Icon.js"; import BusyIndicator from "./BusyIndicator.js"; @@ -220,15 +220,7 @@ class MenuItem extends ListItem implements IMenuItem { } get _navigableItems() { - const navigableItems: Array = []; - - if (!this.hasEndContent) { - return []; - } - - navigableItems.push(...this.endContent); - - return navigableItems; + return [...this.endContent] as Array; } _itemKeyDown(e: KeyboardEvent) {