From b6ce9b9d49a8c567999b557d559f0903433d0f29 Mon Sep 17 00:00:00 2001 From: HendrikThePendric Date: Mon, 25 Nov 2024 17:32:12 +0100 Subject: [PATCH] fix: remove active style from menu item with tabIndex 0 --- components/menu/src/menu-item/menu-item.js | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/menu/src/menu-item/menu-item.js b/components/menu/src/menu-item/menu-item.js index c5ca57385..e3b4c53a4 100644 --- a/components/menu/src/menu-item/menu-item.js +++ b/components/menu/src/menu-item/menu-item.js @@ -10,18 +10,18 @@ import styles from './menu-item.styles.js' const isModifiedEvent = (evt) => evt.metaKey || evt.altKey || evt.ctrlKey || evt.shiftKey -const createOnClickHandler = - ({ onClick, toggleSubMenu, isLink, value }) => - (evt) => { - if ((isLink && isModifiedEvent(evt)) || !(onClick || toggleSubMenu)) { - return - } - evt.preventDefault() - evt.stopPropagation() - - onClick && onClick({ value }, evt) - toggleSubMenu && toggleSubMenu() +const createOnClickHandler = ({ onClick, toggleSubMenu, isLink, value }) => ( + evt +) => { + if ((isLink && isModifiedEvent(evt)) || !(onClick || toggleSubMenu)) { + return } + evt.preventDefault() + evt.stopPropagation() + + onClick && onClick({ value }, evt) + toggleSubMenu && toggleSubMenu() +} const MenuItem = ({ href, onClick, @@ -104,7 +104,7 @@ const MenuItem = ({ destructive, disabled, dense, - active: active || showSubMenu || tabIndex === 0, + active: active || showSubMenu, 'with-chevron': children || chevron, })} ref={menuItemRef}