-
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
Fix: Table block doesn't keep background color #39445
Conversation
Size Change: +7 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
I think that the color palette in the core block does not work is a problem. |
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.
Thank you for fixing this @t-hamano 👍
✅ Can replicate the original issue
✅ After checking out this PR branch, the issue is resolved
If there is any way to avoid these edge cases, please advise.
Given when these deprecations run in the parser, I'm not sure how we can avoid this.
The isEligible
function only gets passed the attributes
and innerBlocks
. They aren't very helpful in this case, in being able to determine if a color palette color shares the same slug as the old table colors.
Due to the severity of the current bug, I'd like to see this PR land and address the edge case in a follow-up if possible.
Thanks for tweaking the changelog entry @t-hamano.
I've taken another look at options to prevent this edge case but haven't found a way around it. Given this PR improves the current state of things I think we should go ahead and merge this. |
@aaronrobertshaw |
You can do the honours and merge this now @t-hamano. 👍 I've already added a backport label to this PR so it can be evaluated for that when the time comes. |
* Fix: Table block doesn't keep background color * add readme * update readme
What?
In table block, the background color is not reflected correctly in the editor if only the background color is selected from the color palette.
Why?
If only the background color is selected in the color palette, html is generated in which only the class is given to the table tag and no style attribute is given, as shown below:
Therefore, the backward-compatibility support for initial table blocks with colors such as
subtle-light-gray
also affects such HTML:How?
In this PR, the initial table block migrate is now limited to only those cases where the background color slug is included in oldColors (
subtle-light-gray
/subtle-pale-green
/subtle-pale-blue
/subtle-pale-pink
)Testing Instructions
Screenshots or screencast
before this PR ( on trunk ):
4ff7662583f52c86c9717a4602b7e437.mp4
About edge case
If the same slug is defined as the old color variation of the table in the custom color palette, it will be considered the initial table block and the oldColors color value will take precedence.
947f349a27be1d17f89d00b4418077bb.mp4
If there is any way to avoid these edge cases, please advise.