-
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
Post Comments Block: "Older Comments" and "Newer Comments" links mis-aligned #40827
Comments
Comparing to the Post Editor, it seems like the "Older Comments" and "Newer Comments" links have the That class seems to be coming from Core's So I guess that style isn't being enqueued for the Site Editor. |
I checked the page source of the Site Editor, and <link rel='stylesheet' id='common-css' href='http://localhost:8888/wp-admin/css/common.css?ver=6.0-beta3-53329' media='all' /> My next best guess is that it has to do with the iframing of the Site Editor (which I know very little about 😅 ). cc/ @youknowriad @gziolo |
Yeah, so this does seem to fix the issue: diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js
index 5596aa0032..435df3a821 100644
--- a/packages/block-editor/src/components/iframe/index.js
+++ b/packages/block-editor/src/components/iframe/index.js
@@ -45,7 +45,6 @@ function useStylesCompatibility() {
} catch ( e ) {
return;
}
-
const { ownerNode, cssRules } = styleSheet;
if ( ! cssRules ) {
@@ -65,6 +64,14 @@ function useStylesCompatibility() {
return;
}
+ let isFilenameMatch = false;
+ if ( styleSheet.href ) {
+ const url = new URL( styleSheet.href );
+ if ( url.pathname === '/wp-admin/css/common.css' ) {
+ isFilenameMatch = true;
+ }
+ }
+
const isMatch = Array.from( cssRules ).find(
( { selectorText } ) =>
selectorText &&
@@ -73,7 +80,7 @@ function useStylesCompatibility() {
);
if (
- isMatch &&
+ ( isMatch || isFilenameMatch ) &&
! node.ownerDocument.getElementById( ownerNode.id )
) {
// Display warning once we have a way to add style dependencies to the editor.
I'll file a PR. |
|
Description
Users that still have the now-deprecated Post Comments block in one of their templates will find that the "Older Comments" and "Newer Comments" links aren't left- and right-aligned like they should be, but stacked on top of each other.
Previously mentioned in the Loom video in #40484.
Step-by-step reproduction instructions
gutenberg/packages/block-library/src/post-comments/block.json
Line 37 in 54fd3bf
Screenshots, screen recording, code snippet
Environment info
No response
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: