-
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
Do not navigate to the styles pages unless you're in a random listing page #52728
Conversation
Size Change: +98 B (0%) Total Size: 1.43 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your comments about the added complexity and how to simplify in different places(DFM). For now though this looks good, if we want to include it in 6.3
const { params } = useLocation(); | ||
const isMobileViewport = useViewportMatch( 'medium', '<' ); | ||
const isListPage = getIsListPage( params, isMobileViewport ); | ||
const isEditorPage = ! isListPage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we don't need an extra param here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully agree with you on the complexity creep in these commands, @youknowriad. I've been very much on the fence about merging this workaround or not, but ultimately I think that this is worth it in order to fix #52626. It just felt like a shame to launch the command palette in 6.3 and let users down with unexpected navigation. :)
I am all for centralizing the behaviors. I remember being over this with @ntsekouras in the past and needing to sprinkle DFM checks all over. I think any action that is incompatible w/ DFM should disable DFM and the caller should not care or be aware of DFM (e.g. open inserter sidebar or similar). |
I just cherry-picked this PR to the update/packages-RC2 branch to get it included in the next release: 99d55d1 |
* Filter out patterns that are not allowed in the inserter (#52675) * Remove autofocus and improve placeholder text consistency. (#52634) * Do not navigate to the styles pages unless you're in a random listing page (#52728) * Patterns: Don't override the rootClientID in create menu - only set if undefined (#52713) * Footnotes: store in revisions (#52686) * Fix: Block toolbar obscuring document tools when Top Toolbar is enabled (#52722) * Update toolbar width * Site editor needs specific width * fixes top toolbar width for post editor when not in fullscreen * remove the body rule --------- Co-authored-by: Andrei Draganescu <[email protected]> * Site Editor: Fix site link accessibility issues (#52744) * Add id to pattern inserted notice to stop multiple notices stacking (#52746) * Global Styles: Don't use named arguments for 'sprintf' (#52782) * Footnotes: Use static closures when not using '' (#52781) * removes check for active preview device type to enable the fixed toolbar preference (#52770) * Parser / Site Editor: Ensure autop is not run when freeform block is set to core/html (#52716) * Parse / Site Editor: Ensure autop is not run when freeform block is set to core/html * Switch to equals freeform instead of not equals core/html * Rename core/test-freeform to core/freeform in tests * Adding @SInCE annotation for relevant 6.3 changes. (#52820) * Navigation: Load the raw property on the navigation fallback (#52758) * Navigation: Load the raw property on the navigation fallback * Update lib/compat/wordpress-6.3/navigation-fallback.php Co-authored-by: Dave Smith <[email protected]> * Update lib/compat/wordpress-6.3/navigation-fallback.php Co-authored-by: Dave Smith <[email protected]> * Add a test for these properties * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * Update phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php Co-authored-by: Dave Smith <[email protected]> * add more comments * add necessary method * Fix php coding standards error --------- Co-authored-by: Dave Smith <[email protected]> Co-authored-by: Jerry Jones <[email protected]> * Allow styles to be changed dynamically through editor settings (#52767) * ResizableFrame: Fix styling in Firefox (#52700) * ResizableFrame: Fix styling in Firefox * Remove unused class * Patterns: Fix empty general template parts category (#52747) --------- Co-authored-by: Glen Davies <[email protected]> --------- Co-authored-by: Carolina Nymark <[email protected]> Co-authored-by: Andrea Fercia <[email protected]> Co-authored-by: Riad Benguella <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Andrew Serong <[email protected]> Co-authored-by: Ramon <[email protected]> Co-authored-by: Ben Dwyer <[email protected]> Co-authored-by: Dave Smith <[email protected]> Co-authored-by: Jerry Jones <[email protected]> Co-authored-by: Lena Morita <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Glen Davies <[email protected]>
Was testing this for 6.3 today and noticed it exposed a minor UI hiccup in the styles revisions in that the panel will show a loading spinner if there are no revisions: 2023-07-24.13.47.52.mp4This was previously hidden behind some logic that only allowed the panel to open if there were revisions. I've added a PR to remove that spinner if the revisions length is |
closes #52626
What?
The site editor offers some commands to navigate to the "styles" sidebar (custom css, learn styles, style revisions...). In trunk, before triggering any of these commands we first navigate to the "styles" page in the site editor. The current PR changes that behavior and instead keeps the current page if the current page is showing a "template" or "page" and is not a listing page.
How?
Let's be clear, I don't like this PR personally, there's no other solution at the moment but if we can accept the behavior in trunk, I think it's better personally. The reason is that while writing a command, we shouldn't have to think about all the modes... and all the possibilities that we might be in, it should be straightforward and this PR adds complexity to the current commands.
Also, we don't have a clear way to check whether we're actually in an "editor"'s page (a page showing a template or page)
The last thing I wanted to mention is that some of these commands started having checks about "distraction mode" and switch back ... I understand the reasoning but I don't like the implementation. It suffers from the same issues as the current PR: adds complexity to the commands but ideally the commands shouldn't have to know that these things are only available in "non distraction free" mode. The solution here would be to update the "reducer" to disable distraction free mode automatically, when we open the styles panel for instance. cc @draganescu
I also noticed that we have some bugs where sometimes trying to open the CSS panel from the revisions panel doesn't work... These bugs are independent of the current PR though, they're just made visible here. (I think for this one is another case where a "controlled Navigator component" would solve the issues) #51915 cc @ciampo
Testing Instructions
Test the "open styles revisions", "learn about styles", "open css"... commands.