-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Site editor: fix nav error due to lack of context provider in narrow viewports #68907
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
Conversation
Size Change: -4 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in d6f7eb1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13001678840
|
Thanks for the PR! I think this PR is working fine and ready to ship, what do you think? I'm thinking of an alternative approach, wrapping diffdiff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js
index a5e14f0be8..b31f691ee7 100644
--- a/packages/edit-site/src/components/layout/index.js
+++ b/packages/edit-site/src/components/layout/index.js
@@ -163,7 +163,7 @@ function Layout() {
{ isMobileViewport && areas.mobile && (
<div className="edit-site-layout__mobile">
- { canvas !== 'edit' && (
+ { canvas !== 'edit' ? (
<SidebarContent routeKey={ routeKey }>
<SiteHubMobile
ref={ toggleRef }
@@ -171,9 +171,13 @@ function Layout() {
isResizableFrameOversized
}
/>
+ <ErrorBoundary>
+ { areas.mobile }
+ </ErrorBoundary>
</SidebarContent>
+ ) : (
+ <ErrorBoundary>{ areas.mobile }</ErrorBoundary>
) }
- <ErrorBoundary>{ areas.mobile }</ErrorBoundary>
</div>
) } However, some CSS tweaks might be required, e.g. Pages screen: What do you think about this approach? However, this approach is primarily intended to limit the scope of coverage for the context provider, and I have no strong opinion regarding this approach. |
P.S. After this PR is merged, I plan to fix the missing horizontal spacing in the mobile layout. At that time, I may make some adjustments to the DOM structure of the |
Thanks for testing this and the alternative suggestion Aki! I don’t have a strong opinion between this or your suggestion. I haven’t tested yours out or thought about how it might impact any further efforts though.
From what I see the value of this context provider is completely stable so I think expanding its scope should make no difference. If you agree, perhaps not having to make any CSS tweaks on this branch makes it more favorable for now. Yet I’m not sure I favor this approach anyway. I have a new alternative #69172 that may be the most advantageous. It removes the need for this context provider and therefore should facilitate doing whatever is best with the markup and style for related concerns/issues like #69156. For now it’s based on #69103 because it relies on a small change in the router that was also needed there. |
Closing this because #69413 takes care of the issue. |
What?
Avoids a non-fatal error being logged in the console when navigating the site editor in narrow viewports.
The changes here were a quick take on this and there certainly may be a better solution.
Why?
To keep the console logs clean. Resolves #68929
How?
Moves the context provider that’s missing in the narrow viewport out/up in the tree so it’s a available for the mobile route area.
Testing Instructions