-
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
Add Core CSS to styles compat hook for editor iframe #40846
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is it okay to check for the full pathname? Is the check sufficient?
Do we need an allowlist of other Core styles that we want to carry over to the iframe?
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.
why do we need this stylesheet inside the iframe? AFAIK it's not something that targets frontend?
AFAIK
alignleft
andalignright
are either supposed to be provided by the theme for classic themes or injected in layout styles for block themes.Is the issue here about classic or block 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.
AFAICT, it is being used on the frontend by Core's
theme-compat/comments.php
fallback, which in turn is used by the Post Comments block (which is a thin wrapper aroundcomments_template()
):https://github.com/WordPress/wordpress-develop/blob/b27069117eb22c39d5230ceb39439f2dab82dc08/src/wp-includes/theme-compat/comments.php#L52-L64
Block themes -- I think that's the main target for the Post Comments block.
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 guess that also means that the current fix is not enough since it only impacts the editor. I think the best solution here is to just add this to the "style.css" of the block like suggested by @Mamaduka that way it applies in both editor and frontend regardless of the theme used. Also, you might you want to target these links specifically and avoid a global rule that apply cross blocks and markup.
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.
Thanks! I had some reservations about this, but I guess it might be the most pragmatic approach then 😅
Can do. Still feels like there might be some need for a more far-reaching solution that makes some of these classes available that are relied on by Core functions that are used by some dynamic blocks on the frontend, but maybe we don't have to solve that here and now... 😬
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.
No, I actually think the opposite. The alignment styles are now generated by layout in block themes for all use-cases. The issue here is an outlier and that doesn't deserve a global fix. In other words blocks shouldn't be assuming that they can use "alignleft", "alignright" and expect these to be defined in all situations. These define on their container for block themes.
So actually, the block could have use custom classes and just target these instead but since it's an old template from Core. We can just add specific styles to the block using the old template.