Skip to content

Commit a212bb4

Browse files
matyasfbalzss
authored andcommitted
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 Fixes INSTUI-4855
1 parent c3fd3b1 commit a212bb4

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
@@ -639,7 +639,9 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
639639
withArrow: false,
640640
minWidth: renderSubmenu.props?.minWidth || '18.5rem',
641641
maxHeight: renderSubmenu.props?.maxHeight || `calc(100vh - 10rem)`,
642-
642+
// this is needed because the trigger is not a button. `aria-expanded`
643+
// is set on `get itemProps()`
644+
shouldSetAriaExpanded: false,
643645
...(status === 'disabled' && {
644646
disabled: true,
645647
show: false,
@@ -695,10 +697,9 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
695697
}
696698
),
697699
isShowingContent: this.state.isPopoverOpen,
698-
// @ts-expect-error This is a force override for Popover, because it puts
699-
// aria-expanded on the trigger when shouldContainFocus="true",
700-
// even when it should be on the item's <button>
701-
'aria-expanded': undefined
700+
// this is needed because the trigger is not a button. `aria-expanded`
701+
// is set on `get itemProps()`
702+
shouldSetAriaExpanded: false
702703
}
703704

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

0 commit comments

Comments
 (0)