Skip to content

Commit

Permalink
fix: remove active style from menu item with tabIndex 0
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Nov 25, 2024
1 parent ce4d3ae commit b6ce9b9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions components/menu/src/menu-item/menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -104,7 +104,7 @@ const MenuItem = ({
destructive,
disabled,
dense,
active: active || showSubMenu || tabIndex === 0,
active: active || showSubMenu,
'with-chevron': children || chevron,
})}
ref={menuItemRef}
Expand Down

0 comments on commit b6ce9b9

Please sign in to comment.