-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styles: top level styles does not open on mobile for sites using themes without style variations #67532
Comments
Props to @supernovia for originally finding and flagging this! |
If we're able to get a PR in place, be sure to add |
I ran git bisect, and it seems that |
Hi, It seems that the following code is causing issues with the style editor not navigating properly: export function SidebarNavigationItemGlobalStyles( props ) {
const { name } = useLocation();
const hasGlobalStyleVariations = useSelect(
( select ) =>
!! select(
coreStore
).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,
[]
);
if ( hasGlobalStyleVariations ) {
return (
<SidebarNavigationItem
{ ...props }
to="/styles"
uid="global-styles-navigation-item"
aria-current={ name === 'styles' }
/>
);
}
return <SidebarNavigationItem { ...props } />;
} Is there a specific reason for checking hasGlobalStyleVariations? It doesn’t appear to be serving any purpose at the moment. Removing it might resolve the issue. Additionally, the following onClick function was removed: <SidebarNavigationItem
{ ...props }
onClick={ () => {
// Switch to edit mode.
history.push(
{
...params,
canvas: 'edit',
},
undefined,
{
transition: 'canvas-mode-edit-transition',
}
);
// Open global styles sidebar.
openGeneralSidebar( 'edit-site/global-styles' );
} }
/>
); This removal seems to have broken the functionality of the "Styles" tab for themes where hasGlobalStyleVariations is false. Patch: if ( hasGlobalStyleVariations ) {
return (
<SidebarNavigationItem
{ ...props }
to="/styles"
uid="global-styles-navigation-item"
aria-current={ name === 'styles' }
/>
);
}
return <SidebarNavigationItem { ...props } to="/styles" aria-current={ name === 'styles' } />; Will be opening PR shortly with the changes. I kept |
It's related to this issue: @t-hamano traced it backed to |
It looks like the PR that affected the nav here isn't in 19.8 either, so I think we're safe to wait for 19.9 |
Hmm I can replicate in 19.7 though and I’d prefer a fix is out for 19.8 rather than waiting two more weeks for 19.9. What am I missing? 😄 |
Apologies, @annezazu. I had a brain short circuit. I've compared 19.8 with trunk and I think a version of the latest clean up PR merged today is the right one to backport: However #67199 has changed a lot since then so I think it will need a special 19.8 PR instead (not to be merged in trunk). Most notably the route params. Trunk uses Here's the PR: cc @bph |
Thank you for the fast and lovely team work here, everyone! |
When a block theme doesn't have style variations, the newer experience for top level styles in the Site Editor does not open on mobile when using GB 19.7 and GB nightly.
Steps to replicate
Videos
With GB 19.7 and OnyxPulse:
ScreenRecording_12-03-2024.07-59-05_1.MP4
With GB nightly and OnyxPulse:
ScreenRecording_12-03-2024.08-03-22_1.MP4
cc @tellthemachines @aaroncampbell @ramonjd @talldan as you all have been working on this!
The text was updated successfully, but these errors were encountered: