-
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
is-sidebar-opened class missing and sidebar has fixed inline width #62599
Comments
@amplify11dev Class names like I think in this case, there are alternative ways you can adjust the width, like using an |
The documentation also states that |
I'll cc @youknowriad who made the change.
I did just share the docs that mention how this is not a breaking change, and it's certainly not a regression. Dev notes are still being worked on for 6.6, so I can follow up to make sure it's captured. Have you considered making an issue requesting resizable sidebars as an enhancement? Alternatively an issue that proposes the editors to offer an API for setting the sidebar width? |
Sorry for the breakage @amplify11dev As shared by @talldan, classnames are not part of the public API (especially modifiers like this) but sometimes we can keep them around if they help third-party developers. In this case though, I'm personally hesitant to restore the classname, because it will add a re-rendering to the editor (all components) when the sidebar is changed causing a performance impact. So if we can find an alternative to what you're trying to do, we could document it in a dev note. Definitely consider opening an issue about making the sidebar resizable or have a preference about it or something. |
Thanks @youknowriad makes sense on the re-render consequence. Ultimately as a developer I just need to be able to control the width of the sidebar only when it's opened. Currently that's hard coded at 280px but we put a lot of stuff into that sidebar and it's easier for our content creators to have more room to work with in there. I'll open a new issue to make that width dynamic somehow. Perhaps that const width = 280 can become something we can filter in PHP or it uses a css3 variable for its width that we can change to a percentage or PX value. |
Hi guys, we have the same issue with the sidebar. We also where changing the width from CSS because Maybe you could add a filter for changing that value? Please understand us right, this is a big problem for us at the moment, a lot of our clients will have a broken UI. |
From my testing this can be worked around in CSS: /* Apply the width only when the sidebar has children */
.interface-interface-skeleton__sidebar:not(:empty) {
width: 33%;
}
.interface-complementary-area__fill,
.interface-complementary-area.editor-sidebar {
width: 100% !important;
}
Yes, the opening/closing won’t animate but that’s hardly critical. |
Hi @stokesman, I also did some tests with CSS and found a solution but it is not very good.
I think the best way would be to add a filter so developers could change that value from JS. |
@sergiu-radu, you’re right the delay is not good. I'm fully in support of adding an API that developers could use partly because I think core could benefit from it too. At the moment, I’m not sure a filter is the best form it could take and tend to think something like extending |
i'm curious - what's the performance advantage for animating width values for the block list + sidebar using framer vs just transitioning in/out? i can see framer potentially being more useful for the full site editor experience (though caveat im not super knowledgeable about the general performance differences between RAF and regular transitions for stuff like this - my understanding pretty much ends at "you can do certain things better with one or the other"), but if it was just a css transition you could provide the sidebar final width as a css variable |
Me too. At least the class name is violating BEM. The
I don’t think that performance was a consideration. The sidebar ( |
Doing this whole animation with transitions is a much better option than trying to make the width configurable through the
I'm happy to work on a PR for extending the above (and already started) but I really think the CSS transitions option + a CSS variable is an option worth exploring. Thoughts? |
AFAIK, it's not possible to implement that way. If you manage to do it, please go ahead and open a PR. For the width, I think we could have a preference, something like |
what isn't possible, specifically? width can be transitioned with a css variable value |
@albanyacademy There are different constraints related to how the components are rendered... I don't want to discourage anyone from trying but it's more complex than just animating the width.
Feel free to try it and I would support it if it works. |
FWIW we’re using the I was able to switch to this selector instead: /* OLD */
.edit-post-layout.is-sidebar-opened
/* NEW */
.edit-post-layout:has(.interface-interface-skeleton__sidebar:not(:empty)) This should work in all browsers that support Update: Here are selectors for all of the states: // Selectors to determine the editor layout
$admin-selector-default: ':where(body:not(.is-fullscreen-mode) .edit-post-layout:has(.interface-interface-skeleton__sidebar:empty))';
$admin-selector-default-sidebar: ':where(body:not(.is-fullscreen-mode) .edit-post-layout:has(.interface-interface-skeleton__sidebar:not(:empty)))';
$admin-selector-fullscreen: ':where(body.is-fullscreen-mode .edit-post-layout:has(.interface-interface-skeleton__sidebar:empty))';
$admin-selector-fullscreen-sidebar: ':where(body.is-fullscreen-mode .edit-post-layout:has(.interface-interface-skeleton__sidebar:not(:empty)))'; |
Description
Previously when opening the right sidebar (settings panel) a classname
is-sidebar-opened
was added to the dom. This allowed developers to know when that sidebar was opened and target the editor with styles. Right now it seems like the right sidebar has a fixed width of 280px (references to const SIDEBAR_WIDTH = 280; in the JS code). It's not clear how developers can adjust this width to be a % rather than a fixed width. The sidebar is far too narrow for our needs. In WordPress 6.5 and previous versions we were able to set the editor width to 60% and the sidebar to 40%. Then using theis-sidebar-opened
class we could change the editor to 100% so there wasn't empty space. Without that classname, or ability to edit the width of the sidebar we're stuck with an empty 40% width div.I'm not sure when or why this behavior changed, but I found this: https://github.com/WordPress/gutenberg/pull/62237/files related PR that seems like it might be removing the class name.
Step-by-step reproduction instructions
Add a new page
Open the right sidebar
Observe the class named
is-sidebar-opened
is visible in WordPress 6.5 and earlierThe width property was previously in CSS
Add a new page
Opened the right sidebar
Observe the class named
is-sidebar-opened
is gone.The width property is now inline hard coded to the divs
Screenshots, screen recording, code snippet
WordPress 6.5 and earlier
WordPress 6.6 Beta
Environment info
Bug Report
Description
Describe the bug.
Environment
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: