core/table keeps core's .5em cell padding where the source table relies on the UA default 1px

Đang mở
#7,035 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 .5em wins.
  • Source: computed td padding is 1px.

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 1px cell padding under the table marker.
  • Add one test with author td{padding:8px} that keeps 8px, and one with cellpadding="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.
Ngôn ngữ chính
PHP
Star
31
Fork
7
Merge trung bình
3 giờ 40 phút
Pull request đã merge (30 ngày)
813

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Automattic/blocks-engine

Tất cả issue của Automattic/blocks-engine

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.