-
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
Editor: Cleanup styles and classnames #62237
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -86,13 +85,12 @@ $z-layers: ( | |||
// Show sidebar above wp-admin navigation bar for mobile viewports: | |||
// #wpadminbar { z-index: 99999 } | |||
".interface-interface-skeleton__sidebar": 100000, | |||
".edit-post-layout__toggle-sidebar-panel": 100000, |
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.
In my test this classname was not being used.
@@ -468,10 +468,6 @@ $color-control-label-height: 20px; | |||
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width; | |||
} | |||
|
|||
.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open { |
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-sidebar-opened classname was not being added in the site editor (where the navigation block is mostly used) which means that I just removed as this style is probably not useful.
'has-metaboxes': hasActiveMetaboxes, | ||
'is-distraction-free': isDistractionFree && isWideViewport, | ||
'has-block-breadcrumbs': |
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 was not used.
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.
We need to keep the has-block-breadcrumbs
class to avoid a regression for this one
'has-metaboxes': hasActiveMetaboxes, | ||
'is-distraction-free': isDistractionFree && isWideViewport, |
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 moved this class within the component.
@@ -206,9 +208,7 @@ export default function EditorInterface( { | |||
isRichEditingEnabled && | |||
blockEditorMode !== 'zoom-out' && | |||
mode === 'visual' && ( | |||
<div className="edit-post-layout__footer"> |
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.
Removed this div as it was useless in my tests.
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.
What does "it was useless" mean? https://wpdirectory.net/search/01HZF570S4FPCYK4W9343A277D
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 was useless within Gutenberg.
Looking at the link above, it seems all of the plugins are actually rendering this div and targeting it themselves. They're basically copy/pasting Gutenberg code in their plugins I'd say. So this change won't have any impact on them.
The only one that can be slightly impacted I think is "Virtual Classroom – Video Conferencing & Online Meeting with BigBlueButton". They're hiding the div using CSS.
@@ -0,0 +1,3 @@ | |||
.editor-editor-interface .entities-saved-states__panel-header { |
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.
Move this style from and applied a style that doesn't rely on external classnames.
@@ -190,7 +190,7 @@ | |||
} | |||
} | |||
|
|||
.is-distraction-free { | |||
.editor-editor-interface.is-distraction-free { |
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 doesn't change anything really but it makes things easier to understand. Relying on global utility classnames is not great because we don't really know who adds the class, the impact...
@@ -194,40 +191,34 @@ | |||
} | |||
} | |||
|
|||
.edit-post-layout, | |||
.edit-site-editor__interface-skeleton { |
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 was not clear to me why these wrappers were needed, so I just removed them and the publish panel sidebars look the same for me. Am I missing something @ntsekouras
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 don't remember exactly, but I think it was something about the top
property for sure and was oriented towards bottom. I tested now and it seemed fine..
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.
Hey @youknowriad & @ntsekouras 👋🏼 Turns out there's a small regression. I have created a PR, but don't have write permissions yet: #62736
Feel free to take a look. Thank you. 🙂
@@ -170,16 +163,6 @@ html.interface-interface-skeleton__html-container { | |||
@include break-medium() { | |||
display: flex; | |||
} | |||
|
|||
.block-editor-block-breadcrumb { |
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.
In my test the breadcrumb looked the same with and without this so I think this was useless (and misplaced anyway)
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.
Current usage: https://wpdirectory.net/search/01HZF59YSMNJB2CYSYYC08CK8Q
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 class hasn't been removed. It's the style that was removed.
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.
@youknowriad it looks like this removal has caused a regression in trunk
in the post and site editors when no block is selected:
As far as I can tell the display: flex
, height
and align-items
were necessary here, and the left padding helped keep the breadcrumbs from bumping up against the edge of the window.
I've put up a revert PR over in #62309 for just this bit of styling to get it back to what it was. We could then look at moving the CSS elsewhere in a follow-up if there's a better place for it?
@@ -234,7 +234,7 @@ export default function Editor( { isLoading } ) { | |||
<SiteEditorMoreMenu /> | |||
<EditorInterface | |||
className={ clsx( | |||
'edit-site-editor__interface-skeleton', |
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.
Looks like WooCommerce uses this class?
https://wpdirectory.net/search/01HZF50T58QDM6WW7MP6WHQ7Y1
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.
They are actually applying the class them selves, so it should be fine
They probably don't need to apply it at all though, it seems useless looking at their code base.
Size Change: -513 B (-0.03%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
'has-metaboxes': hasActiveMetaboxes, | ||
'is-distraction-free': isDistractionFree && isWideViewport, | ||
'has-block-breadcrumbs': |
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.
We need to keep the has-block-breadcrumbs
class to avoid a regression for this one
@@ -185,10 +180,6 @@ export default function Layout() { | |||
'is-full-canvas': canvasMode === 'edit', | |||
'has-fixed-toolbar': hasFixedToolbar, | |||
'is-block-toolbar-visible': hasBlockSelected, | |||
'has-block-breadcrumbs': |
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.
We need to keep the has-block-breadcrumbs
class to avoid a regression for this one
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.
We've discussed recently with @jameskoster that the snackbars should remain in the exact same position regardless of what the UI is showing. It's already the case in trunk and this class is not used at all in our styles.
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.
Thank you. Is there any place I can see the discussion around the topic?
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.
yes, in this PR #61676
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.
Thank you!
Could use an approval here to be able to follow-up with related improvements #62274 |
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.
The code changes look good I did some tests on the post editor, site editor, widgets editor, and customizer widget blocks and things look ok in all of them.
Flaky tests detected in 55dbce1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9351583221
|
…dd/on-async-directives * 'trunk' of https://github.com/WordPress/gutenberg: (72 commits) Top toolbar: fix half a pixel artifacting of the bottom border. (#62225) Fix UI order for theme.json spacing sizes (#62199) Chore: Simplify a padding style on global styles. (#62291) Editor: Avoid remounts of `DocumentBar` (#62214) Add `default-spacing-sizes` and `default-font-sizes` options for classic themes (#62252) Editor: Cleanup styles and classnames (#62237) Scripts: Pin the @wordpress/scripts version to a version supported by WP 6.5 (#62234) Documentation: Better changelogs for the JSX transform upgrade (#62265) Chore: Simplify a padding style on dataviews. (#62276) MediaUpload: Remove dialog markup on close (#62168) Tabs: Prevent accidental overflow in indicator (#61979) Make edit site pagination buttons accessibly disabled. (#62267) Fix: Remove unused code from dataviews styles. (#62275) Re-enable React StrictMode (#61943) Inserter: Return the same items when the state and parameters don't change (#62263) Update instances of text-wrap: pretty to fall back to balance (#62233) Update: Slotfill documentation samples (links, code, and rephrase). (#62271) Try: Fix mover positioning. (#62226) [Mobile] - Image corrector - Check the path extension is a valid one (#62190) Update: Block styles documentation. ...
Co-authored-by: youknowriad <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: juanfra <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: youknowriad <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: juanfra <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: youknowriad <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: juanfra <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]>
This was cherry-picked to the wp/6.6 branch. |
Related #52632
What?
Both site and post editor pass some classnames to the EditorInterface. The PR intends to unify these classnames as much as possible and cleanup some styles. Users of
EditorInterface
component shouldn't have to provide additional classnames for things to work/show properly.Testing Instructions
See inline comments.