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.
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 padding control to the Global Styles sidebar #27154
Add padding control to the Global Styles sidebar #27154
Changes from all commits
8eb649b
7fbbcef
4d677fe
f75e0da
75341a2
52bae1d
97d8c31
5a736a5
5feafdb
2a58dd9
1e23daa
933d259
d97269f
43523bf
5d5cd0d
1e08467
6a4f4f3
8f428c3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 are calling safecss_filter_attr with things like:
Possible to test by setting a user padding and adding
var_dump( "$name: $subvalue" );
before safecss_filter_attr filter call.Name is always background-color or background we need to make sure the name also accounts for the padding properties.
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 intentional, safecss_filter_attr does not check fine-grained semantics of the declaration, it only has 3 cases: 1) the value is fine (does not contain slashes, parenthesis, etc), 2) the value can contain gradients if the property is allowed to have gradients according to kses, and 3) the value can contain URL data if the property is considered safe for that. As per properties, as long they're is in the allowed list, things are fine.
Via theme.json we output more properties than the allowed by the kses function, for example, link color (a CSS Custom Property). I thought the current approach was simpler and equally robust than transforming every property to its CSS form except for link color, which we'd need to transform to another thing.
How do you feel about this?
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 PR doesn't change this behavior so went ahead and merge it. We can continue to discuss whether this is how we want it to behave.
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.
Hi @nosolosw, I think we need to update and use the correct CSS properties because using just two hardcoded properties is not something expected. E.g: A plugin may change to allow using filter safecss_filter_attr_allow_css a specific CSS only on a specific property, and with this approach, we don't respect what the plugin wants to do.
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 are producing styles like:
Could we be smart and output something like "padding: 5px" in these cases? To avoiding sending unrequited bytes over the wire?
I guess we can use a "padding" property every time all for properties are set and the same behavior can be applied to margins borders etc.
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.
That'd be nice, can we get this in in a follow-up?