Skip to content

Commit 8463f1d

Browse files
committed
fix(ItemBase): dont make it focusable if the element is already focusable
1 parent e0be30e commit 8463f1d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/content/ItemBase/ItemBase.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,12 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
551551
} as Props & { ref?: any };
552552
}, [labelProps, mergedLabelRef]);
553553

554+
// Determine if we need FocusableItemBase
555+
// Elements like 'li', 'a', 'button' are already focusable, so we don't need the wrapper
556+
const tag = rest.as;
557+
const isNativelyFocusable = tag === 'li' || tag === 'a' || tag === 'button';
554558
const Component =
555-
tooltip || finalIsDisabled ? FocusableItemBase : ItemBaseElement;
559+
tooltip && !isNativelyFocusable ? FocusableItemBase : ItemBaseElement;
556560

557561
const itemElement = (
558562
<Component

0 commit comments

Comments
 (0)