core/table keeps core's .5em cell padding where the source table relies on the UA default 1px
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with TableAttributesBuilder, where the issue says converted tables already neutralize core's default cell borders, and trace how cell padding and author styles are emitted. Add a test for the reduced table fixture plus the td{padding:8px} and cellpadding="4" cases; done means the default emits 1px under the table marker while both author values remain in effect.
由索引模型根据 Issue 内容生成。
描述
Follow-up to #6861 (merged as #6933, which handles the explicit cellpadding attribute).
Problem
A source table with no cellpadding and no author padding on its cells gets the user-agent default cell padding of 1px. After conversion to core/table, core's .wp-block-table td, .wp-block-table th { padding: .5em } applies instead, at 7px for 14px text. Every row grows by about 12px.
Blocks Engine already neutralizes core's default cell borders for converted tables ("Core supplies borders on every cell. Clear them…" in TableAttributesBuilder). It does not do the same for core's default padding.
Real case: physics.uci.edu /committees/, a roster table of about 60 rows.
| Cell padding | Row height | Page height | |
|---|---|---|---|
| Source | 1px |
27px | 2227px |
| WordPress | 7px |
39px | 3017px (1.35×) |
The same pattern affects other Drupal WYSIWYG tables on the site, such as the seminars listings and the homepage at 390px.
Reduced repro (trunk 925eabd2b4b)
<table cellspacing="0" style="border-collapse:collapse;width:600px"><tbody><tr><td style="height:16pt">Department Chair</td><td style="height:16pt">Kaplinghat</td></tr><tr><td style="height:16pt">Vice Chair</td><td style="height:16pt">Rajaraman</td></tr></tbody></table>
- Output: no padding rule at all for the table's cells, so core's
.5emwins. - Source: computed
tdpadding is1px.
Expected
- Default rule: when no author CSS or inline style declares padding for the cells, and there's no
cellpadding, the converted table's cells get the UA default (padding:1px) under the existing table marker, beating core's.wp-block-table td. - Author padding wins: author cell padding (projected selectors or inline) and
cellpadding(#6933) still take precedence.
Verification
- Add a unit or contract test with the fixture above: the emitted CSS sets
1pxcell padding under the table marker. - Add one test with author
td{padding:8px}that keeps 8px, and one withcellpadding="4"that keeps 4px. - Rendered check: on the physics.uci.edu import,
/committees/rows are about 27px and the page height is within a few percent of the source.
- 主要语言
- PHP
- 星标
- 31
- 派生
- 7
- 平均合并
- 3 小时 40 分钟
- 30 天内合并 PR
- 813
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Automattic/blocks-engine 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/blocks-engine#4943 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/blocks-engine#4942 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
Automattic/blocks-engine#4921 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
Automattic/blocks-engine#775 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 12/100
Automattic/blocks-engine#7505 ·
维护者通常 1 天内回复
查看 Automattic/blocks-engine 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 63/100
phpstan/phpstan-phpunit#361 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
HE-Arc/le-panier-du-coin#49 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 2 天内回复
-
15.0
难度 2/5 1-3 小时 新手友好度 65/100
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
LinkNacional/woo-rede#367 ·