Skip to content

Commit

Permalink
feat(ui5-menu-item): fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor-ads committed Nov 25, 2024
1 parent 20be657 commit b41c57f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
18 changes: 9 additions & 9 deletions packages/main/cypress/specs/Menu.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@ describe("Menu interaction", () => {
cy.get("[ui5-menu] > [ui5-menu-item]")
.as("items");

cy.realPress('{downarrow}');
cy.realPress("{downarrow}");

cy.get("@items")
.eq(1)
.should("be.focused");

cy.realPress('{rightarrow}');
cy.realPress("{rightarrow}");

cy.get("@items")
.eq(1)
Expand All @@ -492,43 +492,43 @@ describe("Menu interaction", () => {
.eq(1)
.should("be.focused");

cy.realPress('{rightarrow}');
cy.realPress("{rightarrow}");

cy.get("@endContent")
.eq(2)
.should("be.focused");

cy.realPress('{rightarrow}');
cy.realPress("{rightarrow}");

cy.get("@endContent")
.eq(3)
.should("be.focused");

cy.realPress('{rightarrow}');
cy.realPress("{rightarrow}");

cy.get("@endContent")
.eq(3)
.should("be.focused");

cy.realPress('{leftarrow}');
cy.realPress("{leftarrow}");

cy.get("@endContent")
.eq(2)
.should("be.focused");

cy.realPress('{leftarrow}');
cy.realPress("{leftarrow}");

cy.get("@endContent")
.eq(1)
.should("be.focused");

cy.realPress('{leftarrow}');
cy.realPress("{leftarrow}");

cy.get("@endContent")
.eq(1)
.should("be.focused");

cy.realPress('{downarrow}');
cy.realPress("{downarrow}");

cy.get("@items")
.eq(2)
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isEnter,
isTabNext,
isDown,
isUp
isUp,
} from "@ui5/webcomponents-base/dist/Keys.js";
import {
isPhone,
Expand Down Expand Up @@ -402,7 +402,7 @@ class Menu extends UI5Element {
} else {
this._menuItems[currentIndex].focus();
}
}
}

_beforePopoverOpen(e: CustomEvent) {
const prevented = !this.fireEvent<MenuBeforeOpenEventDetail>("before-open", {}, true, true);
Expand Down
16 changes: 7 additions & 9 deletions packages/main/src/MenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import type { ListItemAccessibilityAttributes } from "./ListItem.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";
import MenuItemTemplate from "./generated/templates/MenuItemTemplate.lit.js";
import NavigationMode from "@ui5/webcomponents-base/dist/types/NavigationMode.js";
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
import {
isLeft,
isRight
isRight,
} from "@ui5/webcomponents-base/dist/Keys.js";
import List from "./List.js";
import Icon from "./Icon.js";
import BusyIndicator from "./BusyIndicator.js";
import MenuItemTemplate from "./generated/templates/MenuItemTemplate.lit.js";
import {
MENU_BACK_BUTTON_ARIA_LABEL,
MENU_CLOSE_BUTTON_ARIA_LABEL,
Expand Down Expand Up @@ -220,7 +220,7 @@ class MenuItem extends ListItem implements IMenuItem {
}

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

if (!this.hasEndContent) {
return [];
Expand All @@ -242,9 +242,7 @@ class MenuItem extends ListItem implements IMenuItem {
_handleNextOrPreviousItem(e: KeyboardEvent, isNext?: boolean) {
const target = e.target as MenuItem | HTMLElement;

let updatedTarget = target;

const nextTargetIndex = isNext ? this._navigableItems.indexOf(updatedTarget) + 1 : this._navigableItems.indexOf(updatedTarget) - 1;
const nextTargetIndex = isNext ? this._navigableItems.indexOf(target) + 1 : this._navigableItems.indexOf(target) - 1;
const nextTarget = this._navigableItems[nextTargetIndex];

if (nextTarget) {
Expand Down

0 comments on commit b41c57f

Please sign in to comment.