Skip to content

Commit

Permalink
fix: only render secondaryMenu if it should be shown
Browse files Browse the repository at this point in the history
fixes facebook#10704

Issue was that with keyboard, you could reach the primary menu, while it was made invisible by CSS. By not rendering secondaryMenu based on the secondaryMenuShown logic, , we make sure it isn't accessible by keyboard while it is hidden.
  • Loading branch information
hidde authored Nov 21, 2024
1 parent 90e85e8 commit e723116
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ export default function NavbarMobileSidebarLayout({
return (
<div className="navbar-sidebar">
{header}
<div
className={clsx('navbar-sidebar__items', {
'navbar-sidebar__items--show-secondary': secondaryMenuShown,
})}>
<div className="navbar-sidebar__item menu">{primaryMenu}</div>
<div className="navbar-sidebar__item menu">{secondaryMenu}</div>
</div>
</div>
<div className={clsx('navbar-sidebar__items')}>
{secondaryMenuShown ? (
<div className="navbar-sidebar__item menu">{secondaryMenu}</div>
) : (
<div className="navbar-sidebar__item menu">{primaryMenu}</div>
)}
</div>
);
}

0 comments on commit e723116

Please sign in to comment.