Skip to content

Commit b58a1bc

Browse files
committed
fix(ui-top-nav-bar): fix aria-expanded added twice when displaying menus/popups
the root cause is that the trigger supplied to Drilldown/Popover is a div, and the button is deeper down the DOM. I tried to fix the DOM but its tricky, it causes the popover to misalign, and some crashes because it tried to add a ref to InstUISettingsProvider INSTUI-4855
1 parent 68c3e60 commit b58a1bc

File tree

1 file changed

+6
-5
lines changed
  • packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem

1 file changed

+6
-5
lines changed

packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,9 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
636636
withArrow: false,
637637
minWidth: renderSubmenu.props?.minWidth || '18.5rem',
638638
maxHeight: renderSubmenu.props?.maxHeight || `calc(100vh - 10rem)`,
639-
639+
// this is needed because the trigger is not a button. `aria-expanded`
640+
// is set on `get itemProps()`
641+
shouldSetAriaExpanded: false,
640642
...(status === 'disabled' && {
641643
disabled: true,
642644
show: false,
@@ -692,10 +694,9 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
692694
}
693695
),
694696
isShowingContent: this.state.isPopoverOpen,
695-
// @ts-expect-error This is a force override for Popover, because it puts
696-
// aria-expanded on the trigger when shouldContainFocus="true",
697-
// even when it should be on the item's <button>
698-
'aria-expanded': undefined
697+
// this is needed because the trigger is not a button. `aria-expanded`
698+
// is set on `get itemProps()`
699+
shouldSetAriaExpanded: false
699700
}
700701

701702
return <Popover {...popoverProps}>{customPopoverConfig.children}</Popover>

0 commit comments

Comments
 (0)