Skip to content

Commit 2447450

Browse files
committed
fix: remove tabindex from VariantItem after component renders
1 parent c28a14d commit 2447450

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/components/variant-select.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,21 @@ const StyledOverlay = styled(ActionMenu.Overlay)`
1515
`
1616

1717
const VariantItem = ({title, shortName, url, active}) => {
18+
const itemRef = React.useRef(null)
19+
20+
React.useEffect(() => {
21+
// Remove tabindex after the component renders
22+
if (itemRef.current) {
23+
const actionListItem = itemRef.current.closest('[role="listitem"]') || itemRef.current
24+
if (actionListItem) {
25+
actionListItem.removeAttribute('tabindex')
26+
actionListItem.removeAttribute('tabIndex')
27+
}
28+
}
29+
}, [])
30+
1831
return (
19-
<ActionList.Item state={{scrollUpdate: false}} id={shortName} active={active}>
32+
<ActionList.Item ref={itemRef} state={{scrollUpdate: false}} id={shortName} active={active}>
2033
<LinkNoUnderline to={url}>{title}</LinkNoUnderline>
2134
</ActionList.Item>
2235
)

0 commit comments

Comments
 (0)