Skip to content

[6.x] Treat table column widths without a unit as pixels - #20808

Open
brandonkelly wants to merge 1 commit into
6.xfrom
bugfix/20781-unitless-table-widths
Open

brandonkelly wants to merge 1 commit into
6.xfrom
bugfix/20781-unitless-table-widths

Conversation

@brandonkelly

Copy link
Copy Markdown
Member

Description

Editable table column widths without a unit are pixels again, as in Craft 5.

column.width   before                    after
"25"           width: 25  (invalid CSS)  width: 25px
75             width: 75%                width: 75px
"40%"          width: 40%                width: 40%

The Matrix and section site settings tables relied on bare numbers meaning percent, so they now say '50%'.

Evidence

Table field with widths 400 and 100, measured thead th widths:

  • Before: style.width empty; Item 192px, Quantity 309px (sized by content)
  • After: 400px / 100px; Item 400px, Quantity 100px

Section edit's URI Format and Route To columns still split evenly at 50%.

it('treats column widths without a unit as pixels, as Craft 5 did')
  widths ' 25 ', 75, '40%' → ['25px', '75px', '40%']
  before: fails · after: passes

Related issues

Craft 5 treated a unitless editable table column width as pixels. The Vue
table control passed numeric strings through as invalid CSS, so the
browser dropped them, and turned numbers into percentages. Both are now
pixels, and the Matrix and section site settings tables, which relied on
numbers being percentages, say 50% explicitly.

Fixes #20781

Amp-Thread-ID: https://ampcode.com/threads/T-1a8914a2-23e7-4987-9f39-2961bca2b65a
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/ui — open Storybook

No changed components detected in this Storybook.

resources/js — open Storybook

Changed components:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant