Skip to content

Commit

Permalink
feat(ui5-menu): fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor-ads committed Nov 25, 2024
1 parent b41c57f commit 0bf70af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
6 changes: 1 addition & 5 deletions packages/main/src/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 4 additions & 12 deletions packages/main/src/MenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -220,15 +220,7 @@ class MenuItem extends ListItem implements IMenuItem {
}

get _navigableItems() {
const navigableItems: Array<HTMLElement> = [];

if (!this.hasEndContent) {
return [];
}

navigableItems.push(...this.endContent);

return navigableItems;
return [...this.endContent] as Array<HTMLElement>;
}

_itemKeyDown(e: KeyboardEvent) {
Expand Down

0 comments on commit 0bf70af

Please sign in to comment.