-
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
Transform Styles: Update selector so that styles work when custom fields panel is active #62121
Transform Styles: Update selector so that styles work when custom fields panel is active #62121
Conversation
Size Change: +12 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @gyurmey2. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
@@ -54,6 +54,6 @@ test.describe( 'Styles', () => { | |||
await paddingControl.fill( '2' ); | |||
|
|||
// Check the padding value | |||
await expect( block ).toHaveCSS( 'padding-left', '35.4644px' ); | |||
await expect( block ).toHaveCSS( 'padding-left', '35.4932px' ); |
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.
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.
Oh that's going to be a fun test to maintain 🤦
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 think it would be better to use a custom value - e.g. set it to 5px, and then the expected padding-left should be 5px. I can look at updating this as part of the tests I'm working on.
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 it was just updated to a hard-coded value in #62111 so I've reverted the change here.
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 for the PR! I'm thinking we might need to check for both :root :where(body)
and :where(body)
, because there's at least one instance of the latter (the rule that sets the margin to 0) that will otherwise be ignored.
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 for fixing this up @andrewserong 🚀
After a false start due to a local theme issue, this is testing well for me.
LGTM 🚢
Thanks for the reviews, folks! @tellthemachines I've updated the rule to chain the existing rule and the new one (with the new one running first). Does that look okay to do? The output in the post editor seems to look okay to me 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.
Thanks for updating! LGTM now ✅
dd9e141
to
e7302e4
Compare
Thank you, @andrewserong! |
…lds panel is active (WordPress#62121) * Transform Styles: Update selector so that styles work when custom fields panel is active * Try to fix snapshot * Chain new and old selectors to catch margin rule Unlinked contributors: gyurmey2. Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
…lds panel is active (WordPress#62121) * Transform Styles: Update selector so that styles work when custom fields panel is active * Try to fix snapshot * Chain new and old selectors to catch margin rule Unlinked contributors: gyurmey2. Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Fixes #62091
This re-implements the fix from #61602.
Update the selector in
transformStyle
to match the new selector for global styles rules introduced in #61638 (the rules are now prefixed with:root
).Why?
When the styles were prefixed with the addition of
:root
, the transform intransformStyles
that allows the styles to work in the non-iframed editor no longer matched against the global styles rules. This PR should restore the behaviour so that the editor looks correct in both iframed and non-iframed modes.How?
:root
to the selector of thetransformStyle
logic that matches against rules intended for the body elementTesting Instructions
trunk
note that the global styles rules are not applied in the editor. With this PR applied the styles should be restored.Screenshots or screencast