Skip to content
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

Use inline styles. #4824

Closed
wants to merge 36 commits into from
Closed

Conversation

spacedmonkey
Copy link
Member

Trac ticket: https://core.trac.wordpress.org/ticket/58775


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

src/js/_enqueues/wp/customize/preview.js Outdated Show resolved Hide resolved
src/js/_enqueues/wp/customize/preview.js Outdated Show resolved Hide resolved
src/wp-includes/admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/formatting.php Outdated Show resolved Hide resolved
src/wp-includes/embed.php Outdated Show resolved Hide resolved
src/wp-includes/theme-templates.php Outdated Show resolved Hide resolved
src/wp-includes/theme.php Outdated Show resolved Hide resolved
src/wp-includes/theme.php Outdated Show resolved Hide resolved
@spacedmonkey
Copy link
Member Author

@westonruter I have reverted a lot of the changes and found work arounds for other changes. Can you take a look again?

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the changes in the PR look good to me, but others introduce breaking changes we can and should avoid. I left more concrete feedback below.

src/wp-includes/embed.php Outdated Show resolved Hide resolved
src/wp-includes/formatting.php Outdated Show resolved Hide resolved
src/wp-includes/theme-templates.php Show resolved Hide resolved
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @spacedmonkey, LGTM!

@spacedmonkey
Copy link
Member Author

Awaiting @westonruter review here and I will commit.

src/wp-includes/admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/admin-bar.php Show resolved Hide resolved
src/wp-includes/embed.php Show resolved Hide resolved
src/wp-includes/formatting.php Show resolved Hide resolved
src/wp-includes/embed.php Outdated Show resolved Hide resolved
src/wp-includes/admin-bar.php Outdated Show resolved Hide resolved
src/wp-includes/formatting.php Outdated Show resolved Hide resolved
tests/phpunit/tests/blocks/editor.php Show resolved Hide resolved
src/wp-includes/admin-bar.php Show resolved Hide resolved
@azaozz
Copy link
Contributor

azaozz commented Sep 20, 2023

Awaiting @westonruter review here and I will commit.

Please do not commit this unless it is proven useful. As it stands now this partial refactoring doesn't seem like a good idea. See: https://core.trac.wordpress.org/ticket/58775#comment:16. Also there aren't any use cases for it. Why would that be in core?

Also please keep in mind that CSS does work quite differently than JS and PHP. The "Cascading" part in the name means styles are "cascaded", i.e. depend on the underlying styles. Because of this removing or tweaking the default WP styles is generally a bad idea and can be considered backwards compatibility breach. However enabling the removal or tweaking of core's CSS seems to be the only benefit of this partial refactoring. So thinking that this should not be added to core.

@azaozz azaozz self-requested a review September 20, 2023 21:31
Copy link
Contributor

@azaozz azaozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one additional point of feedback here which I had missed before.

return;
}
remove_action( $action, 'wp_admin_bar_header' );
wp_add_inline_style( 'admin-bar', /* language=CSS */ '@media print { #wpadminbar { display:none; } }' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #4773 (comment), I don't think we should have IDE specific annotations in core, unless they are a standard pattern supported by various IDEs.

@felixarntz
Copy link
Member

@azaozz

However enabling the removal or tweaking of core's CSS seems to be the only benefit of this partial refactoring. So thinking that this should not be added to core.

That is not a benefit of this PR. You can already do that today by unhooking the functions that print it.

The "Cascading" part in the name means styles are "cascaded", i.e. depend on the underlying styles.

This is in fact a good reason for this change: The PR ensures those core styles make use of the WP_Styles API and thus can be properly depended upon, which isn't possible as of today.

spacedmonkey and others added 3 commits September 21, 2023 13:05
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny suggestion more

src/wp-includes/admin-bar.php Show resolved Hide resolved
src/wp-includes/theme-templates.php Outdated Show resolved Hide resolved
Co-authored-by: Weston Ruter <westonruter@google.com>
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@spacedmonkey
Copy link
Member Author

@felixarntz IDE type hinting was removed in 5b8bc3c

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @spacedmonkey, LGTM!

@spacedmonkey
Copy link
Member Author

Committed 54c4de1

@andrewserong
Copy link
Contributor

As far as I can tell, I think this PR has introduced a regression for editor styles in the block editor.

Before this change After this change
image image

When looking at the markup for the post editor, there appears to now be a deprecation notice injected into __unstableResolvedAssets within the post editor's initializeEditor initial state:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants