@@ -12,7 +12,15 @@ import CounterLabel from '../CounterLabel'
1212import { useTheme } from '../ThemeProvider'
1313import { ChildWidthArray , ResponsiveProps , OnScrollWithButtonEventType } from './types'
1414
15- import { moreBtnStyles , getDividerStyle , getNavStyles , ulStyles , scrollStyles , moreMenuStyles } from './styles'
15+ import {
16+ moreBtnStyles ,
17+ getDividerStyle ,
18+ getNavStyles ,
19+ ulStyles ,
20+ scrollStyles ,
21+ moreMenuStyles ,
22+ menuItemStyles
23+ } from './styles'
1624import { ArrowButton } from './UnderlineNavArrowButton'
1725import styled from 'styled-components'
1826import { LoadingCounter } from './LoadingCounter'
@@ -216,6 +224,8 @@ export const UnderlineNav = forwardRef(
216224
217225 const isCoarsePointer = useMedia ( '(pointer: coarse)' )
218226
227+ const [ asNavItem , setAsNavItem ] = useState ( 'a' )
228+
219229 const [ selectedLink , setSelectedLink ] = useState < RefObject < HTMLElement > | undefined > ( undefined )
220230
221231 const [ focusedLink , setFocusedLink ] = useState < RefObject < HTMLElement > | null > ( null )
@@ -339,6 +349,7 @@ export const UnderlineNav = forwardRef(
339349 selectedLinkText,
340350 setSelectedLinkText,
341351 setFocusedLink,
352+ setAsNavItem,
342353 selectEvent,
343354 afterSelect : afterSelectHandler ,
344355 variant,
@@ -375,29 +386,32 @@ export const UnderlineNav = forwardRef(
375386 { actions . map ( ( action , index ) => {
376387 const { children : actionElementChildren , ...actionElementProps } = action . props
377388 return (
378- < ActionList . Item
379- key = { index }
380- { ...actionElementProps }
381- onSelect = { (
382- event : React . MouseEvent < HTMLLIElement > | React . KeyboardEvent < HTMLLIElement >
383- ) => {
384- swapMenuItemWithListItem ( action , index , event , updateListAndMenu )
385- setSelectEvent ( event )
386- } }
387- >
388- < Box
389- as = "span"
390- sx = { { display : 'flex' , alignItems : 'center' , justifyContent : 'space-between' } }
389+ < Box key = { index } as = "li" >
390+ < ActionList . Item
391+ as = { asNavItem }
392+ sx = { menuItemStyles }
393+ { ...actionElementProps }
394+ onSelect = { (
395+ event : React . MouseEvent < HTMLLIElement > | React . KeyboardEvent < HTMLLIElement >
396+ ) => {
397+ swapMenuItemWithListItem ( action , index , event , updateListAndMenu )
398+ setSelectEvent ( event )
399+ } }
391400 >
392- { actionElementChildren }
393-
394- { loadingCounters ? (
395- < LoadingCounter />
396- ) : (
397- < CounterLabel > { actionElementProps . counter } </ CounterLabel >
398- ) }
399- </ Box >
400- </ ActionList . Item >
401+ < Box
402+ as = "span"
403+ sx = { { display : 'flex' , alignItems : 'center' , justifyContent : 'space-between' } }
404+ >
405+ { actionElementChildren }
406+
407+ { loadingCounters ? (
408+ < LoadingCounter />
409+ ) : (
410+ < CounterLabel > { actionElementProps . counter } </ CounterLabel >
411+ ) }
412+ </ Box >
413+ </ ActionList . Item >
414+ </ Box >
401415 )
402416 } ) }
403417 </ ActionList >
0 commit comments