WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.46k stars 4.17k forks source link

Table block border issue in various theme. #61491

Open viralsampat-multidots opened 5 months ago

viralsampat-multidots commented 5 months ago

Description

Hello,

I have reviewed the "table block" and found that table block border is not displaying same on editor side and front-end side when we changed its text color.

I think that it should be on both side(Editor & Front-end)

I have checked this issue on the below-mentioned theme.

Step-by-step reproduction instructions

Screenshots, screen recording, code snippet

twentyseventy-back-end twentyseventy-front-end twentysixteen-back-end twentysixteen-front-end

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

marcarmengou commented 4 months ago

Reproduction Report

This report validates that the issue can be reproduced.

Environment

Actual Results

Additional Notes

Supplemental Artifacts

Editor

1

Front-end

2

github-actions[bot] commented 3 months ago

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

jasmussen commented 1 month ago

Took a look at this one.

Twenty Fifteen tt15 tt15-front

The colors are from the theme itself, it outputs this, which causes the color control to not work:

/* Table */

.wp-block-table th,
.wp-block-table td {
    border-color: #eaeaea;
    border-width: 0 1px 1px 0;
}

Twenty Sixteen tt16 tt16-front

Here, the colors are also from the theme itself:

/* Table */
.wp-block-table,
.wp-block-table th,
.wp-block-table td {
    border: 1px solid #d1d1d1;
}

Twenty Seventeen

tt17

tt17-front

Here, colors on the frontend are coming from the theme itself, but are not loaded into the editor:

/* Table */

.wp-block-table thead th {
    border-bottom: 2px solid #bbb;
    padding-bottom: 0.5em;
}

.wp-block-table tr {
    border-bottom: 1px solid #eee;
}

.wp-block-table th,
.wp-block-table td {
    border: 0;
}

Summary

A couple of issues at play here:

As far as options for next steps, we don't have a lot of options. The way the table block works in a pure block theme is that it applies a 1px solid currentColor style by default. That means the default border color is inherited from the Text color.

Screenshot 2024-08-27 at 09 18 02

You can then separately change the border width, without setting a color, and the color remains inherited from the text: Screenshot 2024-08-27 at 09 18 10

Finally, you can set a border color, which sets the border color:

Screenshot 2024-08-27 at 09 18 24

So the main problem here is, even if we were able to increase the specificity of the text color, these three themes would not inherit it.

The separate border-width and border-color, if you apply those, they do in fact affect Twenty Seventeen, as they should, in both editor and frontend: seventeen editor

seventeen front

So it's in the inheritance of the text color, that these three themes do not work.

Which means, if we were to fix this, it would need patches for all three themes, and unfortunately that seems unlikely to be feasible, since changing the table styles to use currentColor instead of their currently applied colors, would be a breaking visual change for every site that uses those themes.

The change we can make, which I'd recommend be opened as a new Trac issue for Twenty Seventeen, is a report that block styles are not loaded into the editor, as they should be.

Thanks for the report! What do you think?