-
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
Site Editor: Fix routing for Classic themes using block-based template parts #48343
Conversation
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.
Tests LGTM 👍
); | ||
|
||
const templatePart = page | ||
.getByRole( 'table' ) |
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.
Off-topic: We should probably fix this by giving the table an accessible name in another PR 😅 .
Size Change: +26 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Template Parts for Classic themes', () => { |
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.
Great idea to have an e2e test for this, we don't check this flow often manually.
return ( | ||
<SidebarNavigationScreen | ||
isRoot={ isTemplatePartsMode } |
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.
This is a bit weird to be honest, I think the ideal solution for this "mode" is to probably have its own "init function" rather than rely on the default site editor initialization function. In the long term, I'm certain this "hack" is going to bite us. By "Hack" I mean the fact that we kind of try to load a specific version of the site editor for the "template parts" screen of classic themes.
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.
It's still the same site editor; we don't want some routes to be available for Classic themes.
But I agree this "hack" isn't the best way to solve this problem. I will try to explore different init methods for WP 6.3.
Flaky tests detected in 15e9490. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4250314345
|
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 tested this locally on a site that has been using this feature since it was originally released. I can confirm this works on WordPress 6.2 Beta 3 with this version of Gutenberg activated.
Thank you for the fix :)
Something that is a little confusing though is the navigation sidebar. You correctly get moved to the "Manage all template parts screen" but that means that you now have to navigate back by two levels. And the one in between is kind of odd because it shows the same exact information that you already see. (see attached video)
CleanShot.2023-02-23.at.10.28.06.mp4
Thanks for testing, @fabiankaegy! I tried to make as few changes to the new sidebar navigation as possible. Viewing the list in the sidebar might be confusing, but I found it helpful when navigating away editor. Let's explore a better editor initialization for the next major release - #48343 (comment). |
…e parts (#48343) * Site Editor: Fix routing for Classic themes using block-based template parts * Add basic e2e tests * Update theme stylesheet name
I just cherry-picked this PR to the wp/6.2 branch to get it included in the next release: 21ba2d8 |
To display a list of block-based template parts for classic themes, this changeset adds a `path` query arg to the Appearance > Template Parts menu URL. This change is necessary due to recent changes to Site Editor's client-side routing. Reference: * [WordPress/gutenberg#48343 Gutenberg PR 48343] * [WordPress/gutenberg#42729 Gutenberg PR 42729] Follow-up to [55392], [54176]. Props mamaduka, audrasjb, fabiankaegy, hellofromTonya, kevin940726, mukesh27, youknowriad. Fixes #57819. git-svn-id: https://develop.svn.wordpress.org/trunk@55435 602fd350-edb4-49c9-b593-d223f7449a82
To display a list of block-based template parts for classic themes, this changeset adds a `path` query arg to the Appearance > Template Parts menu URL. This change is necessary due to recent changes to Site Editor's client-side routing. Reference: * [WordPress/gutenberg#48343 Gutenberg PR 48343] * [WordPress/gutenberg#42729 Gutenberg PR 42729] Follow-up to [55392], [54176]. Props mamaduka, audrasjb, fabiankaegy, hellofromTonya, kevin940726, mukesh27, youknowriad. Fixes #57819. Built from https://develop.svn.wordpress.org/trunk@55435 git-svn-id: http://core.svn.wordpress.org/trunk@54968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
To display a list of block-based template parts for classic themes, this changeset adds a `path` query arg to the Appearance > Template Parts menu URL. This change is necessary due to recent changes to Site Editor's client-side routing. Reference: * [WordPress/gutenberg#48343 Gutenberg PR 48343] * [WordPress/gutenberg#42729 Gutenberg PR 42729] Follow-up to [55392], [54176]. Props mamaduka, audrasjb, fabiankaegy, hellofromTonya, kevin940726, mukesh27, youknowriad. Fixes #57819. Built from https://develop.svn.wordpress.org/trunk@55435 git-svn-id: https://core.svn.wordpress.org/trunk@54968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
To display a list of block-based template parts for classic themes, this changeset adds a `path` query arg to the Appearance > Template Parts menu URL. This change is necessary due to recent changes to Site Editor's client-side routing. Reference: * [WordPress/gutenberg#48343 Gutenberg PR 48343] * [WordPress/gutenberg#42729 Gutenberg PR 42729] Follow-up to [55392], [54176]. Props mamaduka, audrasjb, fabiankaegy, hellofromTonya, kevin940726, mukesh27, youknowriad. Fixes #57819. Built from https://develop.svn.wordpress.org/trunk@55435 git-svn-id: http://core.svn.wordpress.org/trunk@54968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
PR updates the new site editor navigation screen and routing to work with "Template Parts Mode".
I've also included new E2E tests to catch similar regressions as early as possible.
See #42729 for more details about the original feature.
Why?
There were a few regressions after recent Site Editor refactoring.
How?
SidebarNavigationScreenTemplates
is set to be the root when an editor is accessed in this mode.Testing Instructions
The templates sidebar navigation screen works as before for block themes.
emptyhybrid
theme. It can be symlinked from the plugin.Screenshots or screencast
CleanShot.2023-02-23.at.11.12.49.mp4