Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix active tab when selecting a tab on mobile viewport then switching…
… to desktop
  • Loading branch information
talldan committed Aug 24, 2021
commit b7167d9e6013340bd32e9c625a60bfb71f2ddfd9
9 changes: 8 additions & 1 deletion packages/interface/src/components/preferences-modal/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ export default function PreferencesModalTabs( { tabs } ) {

// On big screens, do a tabbed layout.
if ( isTabbedLayout ) {
// If the 'top level menu' is selected in the navigation layout, treat
// it as an unselected tab.
const hasUnselectedTab =
! activeTabName || activeTabName === TOP_LEVEL_MENU_NAME;

return (
<TabPanel
className="interface-preferences-modal__tab-panel"
tabs={ tabs }
initialTabName={ tabs[ 0 ].name }
initialTabName={
hasUnselectedTab ? tabs[ 0 ].name : activeTabName
}
onSelect={ setActiveTabName }
orientation="vertical"
>
Expand Down