-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Feedback on adoption approach for exposing editable UI for the Style Book for Classic themes #68036
Comments
Speaking from experience, in my agency days doing (now "classic") custom themes I typically created a private page as a style guide, which was quite similar to the Style Book. It wasn't intended for editing, but for visual reference and to ensure we had all the major elements covered. There may or may not have been liberal use of Save+Refresh while dialing in the stylesheet 🫣. I like the idea of having this as a utility for any classic theme. It shows off some coolness that block themes get, but also reveals what elements/blocks you might have missed in your styles. It could be a subtle hint to upgrade to For those used to working with classic themes, I don't think there's much of an expectation of being able to live-edit with a design "preview" feature like this. |
I think it needs to be very clear that, in its current iteration, the style book doesn't include any editing UI. What is being discussed for future iterations is how to expose parts of the global styles UI for hybrid themes that have a theme.json. There are a couple possibilities:
Based on the feedback in #41119, I'm more inclined towards the second option, as theme authors may want to leverage theme.json for styling purposes without necessarily exposing edit functionality. Having controlled editability is one of the reasons for creating a hybrid theme instead of a block theme in the first place. I'm very curious to hear what other folks have to say on the topic! |
Ah yes! Let me update to make that far clearer. Thank you. |
I think the important thing here is that Considering that, relying on the existence of Personally, I prefer the following approach:
Or, to show/hide some UI, we might be able to consider the following approach in theme.json: {
"version": 3,
"settings": {
"typography": {
"showGlobalStylesUI": false
},
"color": {
"showGlobalStylesUI": true
}
}
} |
I've prefixed most of my feedback on this issue that I do not feel strongly about this, and think that folks who feel more strongly about this, should decide. So I'm happy to support either direction. I did want to respond to this:
The motivation for relying on the existance of theme.json comes down to a few aspects:
Ultimately, I do feel strongly about letting users opt into editable aspects of the style book. But whether the style book itself is opted into our out of, I'll defer despite the stated not-so-strong opinion. |
In my opinion, the correct way would be for the new feature to be opt-in, because the majority of older classic themes have not been tested with block styles. By not having it opt-in there is a big potential to introduce a broken feature and a confusing feature on many live websites.
|
Correct, theme.json is not a required file for block themes. |
We could also make it opt-in using extra arguments for Example: add_theme_support( 'editor-styles', array(
'style-book' => true,
) ); |
What happens if the parent classic theme does not have templates/index.html and style.css files but a child theme does? |
After re-reading the discussion in #67782,
But not when the classic theme only has the editor style theme support, because of how long this has been available and because in my opinion, it is unlreated. All classic themes should be able to opt-out, even if it has a theme.json. For example if the theme developer has already added their own style guide. But the theme support as well as the check for it needs to be added in way that allows the theme developer to extend the functionality once it is implemented. I mean as discussed above, if the theme.json file includes typography settings, the typography should be available. Because we don't want to have to change the formatting of the theme support later because all planned features were not implemented yet. |
I haven't checked in a while, but we already enabled some theme support flags based on It would be nice to avoid some implicit logic based on what A classic theme with a The A classic theme without a The |
I agree with the approach of being explicitly enabled or disabled via theme support. By the way, I remember seeing an issue somewhere considering exposing the global styles to the classic theme. Taking this into consideration, I think one of the following approaches might be the best: add_theme_support( 'editor-styles', array(
'style-book' => true,
'gloabl-styles' => true,
) ); add_theme_support( 'site-editor', array(
'style-book' => true,
'gloabl-styles' => true,
) ); |
yeah using "site-editor" to plan for future changes sounds like a good idea |
Using the |
With the additional parameters, the fact that editor-styles has been used for many years is not a hindrance anymore 👍 . But they are not editor styles. The default block styles and the global styles are applied to blocks both in the editor and front. |
Current: Also: |
I found that with Gutenberg trunk active, the stylebook is now always accessible through wp-admin/site-editor.php?p=stylebook for all classic themes. So what should happen when this paged is accessed? |
OK, it is not only the stylebook, but also wp-admin/site-editor.php?p=%2Ftemplate including the add new template button, I don't think this is intended. |
This is certainly not intended. The Gutenberg plugin hooks gutenberg/lib/compat/wordpress-6.8/site-editor.php Lines 118 to 124 in 80348e7
|
Yes as the problem kept growing I opened a separate issue for it #68950 |
I know this is not helping but I am more and more torn about this. If the end goal is to unify the editors, and make the styles, patterns, parts, templates, available no matter what the theme type is, -especially user created templates: then the opt-in is going to be a hindrance. I still think that the stylebook will be problematic for some classic themes because what you see is not what you get. But long term, having it be opt-out may be better for the majority. |
I was ping'd by @Mamaduka about this and did a read-through. Thanks so much for the follow-up @carolinan! Is the current consensus that this can remain a default, without a way to opt-out manually? Would it still be helpful to still add a theme support flag to be able to opt-out, rather than opt-in? |
I am not able to speak for everyone and say if there is consensus. So to opt-out using a theme support: |
remove_theme_support currently does not check nested arrays, so adding a "complex" support like Maybe there are other uses cases for expanding remove_theme_support.
|
To achieve this, I think we need to update the internal function _remove_theme_support(). For example, the I don't have a strong opinion on what key to use for theme support, but I prefer to expose the StyleBook by default to all classic themes and add a theme support flag to opt-out. |
I don't feel strongly for or against adding an opt out for block themes. I have not seen any requests for it. Are there options other than using remove_theme_support, that would make sense for both classic and block themes? Because registering and enabling a theme support by default only so that you can remove it feels backwards. |
I am also concerned about the time, since it needs to be solved before beta 1. If it is not solved, or not agreed upon, it may need to be paused and not included in 6.8. |
First of all, I would be happy to see a consensus on which approach we should take: should the StyleBook rely on the theme support, or on the presence of theme.json and editor styles? Based on the discussion so far, it seems like most contributors would prefer opt-in/opt-out theming support. Once this is decided, I think we can move forward with preparing to ship the StyleBook for 6.8, whether it should be enabled by default or not. |
I am not sure how to say this without making it sound like a complaint or rant, but how do we as contributors know when consensus have been reached? At the moment this is just going in circles, and it is partially my fault. |
@carolinan and @t-hamano, thanks for continuing to push this effort forward. Here's my current understanding of the state of this feature, so please correct me if I've gotten anything wrong. Current status (I think 😄)Currently in GB trunk, the Style Book is shown to all classic themes that either declare theme support for 'editor-styles' or has a There is currently an open PR that proposes modifying support for showing the Style Book to an explicit ObservationsIn terms of the PHP side of things, I'm happy with the proposed theme support approach for an initial WP commit with a few observations: There are issues in the UI that still need to be addressed, even after the approach from #69043 (or an alternative) is committed. The current PR changes the name and path of the menu item in the admin sidebar so it opens either the Design panel (with the style book) or the Patterns page directly (when theme support is removed). Even so, the Stylebook is still available when linking directly to the Patterns screen because of the logic used here to display the Stylebook navigation item in the Screen.Recording.2025-02-22.at.6.00.34.PM.movA separate detail is that these pages are still accessible if someone directly visits those URLs even if we aren't showing the navigation (see: #69005). In my opinion, this is a nice to have but not a blocker. Fixing the navigation flows in the UI, however, do seem like a blocker for keeping this feature for 6.8, but can be iterated on during beta if needed. Should we apply |
@joemcgill Thank you for the detailed summary!
Yes, all of these are correct. Originally, the reason why it was proposed to provide a way to opt out or opt in to the StyleBook in classic themes was, as I understand it, for two reasons:
I think these two points should not apply to block themes. Therefore, in my opinion, the StyleBook theme support is only for classic themes, and block themes should always display StyleBook regardless of their theme support. Personally, I have not heard of any request to be able to disable StyleBook in block themes. |
Yes, this is a separate and broader issue. It also seems it would qualify as a regression since 6.7 and therefore be eligible to fix after the beta. I also agree that the Stylebook theme support doesn’t need to work for block themes. I don’t think shipping it that way prevents making it work in the future. |
Thank you so much for the summary on this @joemcgill, that was very helpful to come to when asked for feedback. Whist I do have an issue with the navigation flows from a usability perspective I am not against us working on them during beta 1. However, for me it is a bit of a ‘moved my cheese’ moment for any user in its current form. This feels compounded by the fact it goes to the top for ’Styles’
I am not convinced in that either. I wanted to as we work on this surface a the comment back in December from @jasmussen # so we can use the also in decisions here.
What I am doing by sharing this is focusing us on whatever approach we go with making sure it serves those purposes that I agree with wholeheartedly. |
I am very confused because when this was discussed on Slack in January @karmatosed you wrote:
Which is one of the reasons why I changed my own opinion about having it be opt-in and instead, have it enabled by default. |
After having discussed this for over two months, we are back at square one again, a few hours before the punting deadline? |
I am now going to step away from this task because its not a healthy environment for me. |
I came across a core PR that updates the submenu based on the current Gutenberg plugin specs: WordPress/wordpress-develop#8429 In other words, the availability of StyleBook is determined based on the following condition: ! wp_is_block_theme() && ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() In other words, classic themes that meet the above conditions will have the "Design" submenu, and classic themes that do not will have the "Patterns" submenu. However, there is currently a UI issue with Gutenberg where even if a theme does not support StyleBook, you can still navigate from the Patterns screen to the higher-level Design screen and access StyleBook from there. Regardless of how we expose StyleBook, this problem needs to be resolved. To solve this, we need to restrict access based on conditions that are equal to the PHP code in the site editor:
As you can see, as far as I know, there's no way to tell with the Gutenberg API if the currently active theme has a theme.json file or not. In fact,
Any ideas on this? |
Hi @t-hamano! I opened that Core PR mostly so we had the potential to commit and test what is currently implemented in this repo while continuing to work out the details about how we determine "support" for this feature and ensure that the UI flows still account for when a theme does not support the stylebook. Making sure these flows still work regardless of what logic we end up using to determine "support" is important, or else we'll need to revert all of the stylebook changes One way to test these flows currently in the GB plugin is to comment out this line with a classic theme, like Twenty Ten activated. I think using |
Regardless of how we ultimately publish the StyleBook, I have submitted two PRs to properly publish the StyleBook based on the current Gutenberg spec. |
Context:
As of Gutenberg 19.9, the Style Book is now exposed to Classic themes. As it stands, support is available for Classic themes that either support editor styles via
add_theme_support( 'editor-styles' )
or have a theme.json file. Without either, the Style Book doesn't display anything useful. Here's a quick demo using Twenty Twenty-One:tt1.style.book.mov
In particular, the current thinking is that by having a theme.json file in a Classic theme that this marks an explicit opt in and, to quote @jasmussen, "edibility is progressive, insofar as if your theme.json is empty, or virtually empty, little to nothing would be editable. But for each array you add, whether that array is empty or not, would unlock part of the interface." For example, if you add
settings.typography
options, this would then give a user access to the UI for Typography and, potentially in the future, the font library.With all of this in mind, another PR is open to enable the Style Book regardless of whether a classic theme has theme.json or supports editor styles! All of this begs the question and points to needing to get right the opt in and opt out approach to provide the most value when it comes to exposing editable UI to users of classic themes. This issue seeks to gather that feedback to ensure we can come to the best decision possible.
Feedback needed
From what I can see we have two main tension points:
Please share feedback on the current approach and the desired approach you'd like to see. cc @WordPress/outreach & @WordPress/block-themers for good measure.
The text was updated successfully, but these errors were encountered: