fix(table): removed first/last child padding, added inset#7050
fix(table): removed first/last child padding, added inset#7050mattnolting wants to merge 9 commits intopatternfly:mainfrom
Conversation
|
Preview: https://patternfly-pr-7050.surge.sh A11y report: https://patternfly-pr-7050-a11y.surge.sh |
mcoker
left a comment
There was a problem hiding this comment.
I'm seeing slightly different results in the backstop report - backstop-first-last-child-table.pdf.
At a glance, it looks like expandable toggles are no longer aligned with the row text? https://patternfly-pr-7050.surge.sh/components/table#expandable
cc @lboehling, would you mind looking at the report or table examples and see if this looks as you'd expect?
d7689aa to
8c8e486
Compare
TLDR:Line height has been standardized to create consistent row height. Currently, rows without actionable elements are shorter than rows with actionable elements. Table sort buttons are shorter than plain buttons (row toggles) which creates a presentational difference, especially notable when a @lboehling @kaylachumley @andrew-ronaldson Can you take a look at Backstop report? What changed
Help Checkboxes Radio Expandable Compact Compound expansion Favorites Compact Borderless Compound expansion Tree table
Mobile presentation has been simplified and has changed slightly as a result
|
8c8e486 to
c4eff46
Compare
srambach
left a comment
There was a problem hiding this comment.
I haven't made it all the way through, but ran regression tests on the table examples. I'm seeing some shifts in all different directions and really can't discern what's correct.
I believe the line height change causes some to move up, some down. Spot checks on the desktop width show they are 21px with 16px top and bottom, so that's good.
Mobile view seems to show increased height; is that also intended? e.g. pf-core__components_table_html_sortable-example_0_document_0_mobile.png
Left-right shifts seem to be a difference in padding - I can't actually tell from the issue description - what's the desired padding?
A couple of other things I noticed:
/components/table/html/borderless-expandable-example has some expanded content that lost it's left padding
/components/table/html/borderless-with-compound-expansion-example the kebabs no longer align horizontally between the main table and expanded section
e913423 to
e085400
Compare
15ef767 to
4d6585d
Compare
|
Backstop report PDF - https://drive.google.com/file/d/1KK0zfG0OJPquXKql5AhnLY8pKRWMJWL-/view?usp=sharing
cc @srambach |
b826b1b to
6dfc8ee
Compare
153ebe8 to
a648b9c
Compare
a648b9c to
31b29de
Compare
|
Updated Table Iso Backstop Report |
| --#{$table}--cell--PaddingBlockStart: var(--#{$table}--m-grid--cell--PaddingBlockStart); | ||
| --#{$table}--cell--PaddingInlineEnd: var(--#{$table}--m-grid--cell--PaddingInlineEnd); | ||
| --#{$table}--cell--PaddingBlockEnd: var(--#{$table}--m-grid--cell--PaddingBlockEnd); | ||
| --#{$table}--cell--PaddingInlineStart: var(--#{$table}--m-grid--cell--PaddingInlineStart); |
There was a problem hiding this comment.
--#{$table}--cell--PaddingBlockStart--#{$table}--cell--PaddingInlineEnd--#{$table}--cell--PaddingBlockEnd--#{$table}--cell--PaddingInlineStart
These values are being assigned on lines 141-145 rather than variable chaining. Controlling the chained variables, especially when getting further into modifiers like m-compact, m-clickable, m-selectable, is overly complicated and very fragile. Standard assignment provides clarity, prevents unintended value inheritance, enhances readability, and avoids forced reflows.
.#{$table}__th, .#{$table}__td {
padding-block-start: var(--#{$table}--m-grid--cell--PaddingBlockStart);
padding-block-end: var(--#{$table}--m-grid--cell--PaddingBlockEnd);
padding-inline-start: var(--#{$table}--m-grid--cell--PaddingInlineStart);
padding-inline-end: var(--#{$table}--m-grid--cell--PaddingInlineEnd);
| --#{$table}-td--responsive--GridColumnGap: var(--pf-t--global--spacer--md); | ||
| --#{$table}--cell--responsive--PaddingBlockStart: var(--pf-t--global--spacer--md); | ||
| --#{$table}--cell--responsive--PaddingBlockEnd: var(--pf-t--global--spacer--sm); | ||
| --#{$table}--cell--first-child--responsive--PaddingBlockStart: var(--pf-t--global--spacer--sm); |
There was a problem hiding this comment.
--#{$table}--cell--first-child--responsive--PaddingBlockStart is no longer necessary as padding is being redefined without targeting first/last children in the grid layout.
| --#{$table}--m-compact__check--responsive--MarginBlockStart: #{pf-size-prem(7px)}; | ||
| --#{$table}--m-compact__action--responsive--MarginBlockStart: calc(var(--pf-t--global--spacer--xs) * -1); | ||
| --#{$table}--m-compact__action--responsive--MarginBlockEnd: calc(var(--pf-t--global--spacer--xs) * -1); | ||
| --#{$table}--m-compact__check--responsive--MarginBlockStart: var(--pf-t--global--spacer--sm); |
There was a problem hiding this comment.
This can be removed as it's no longer used or necessary.
| --#{$table}--m-grid__check--MarginInlineStart: var(--#{$table}__tbody--responsive--border-width--base); | ||
| --#{$table}--m-grid__check--PaddingBlockStart: var(--pf-t--global--spacer--sm); |
There was a problem hiding this comment.
All other variables including --#{$table}--responsive should be updated to --#{$table}--m-grid as they are each others equivalent, and using them interchangeably is confusing and adds complexity.
| // * Table caption selected | ||
| --#{$table}--m-grid__caption--PaddingInlineEnd: var(--pf-t--global--spacer--lg); | ||
| --#{$table}--m-grid__caption--PaddingInlineStart: var(--pf-t--global--spacer--lg); | ||
|
|
There was a problem hiding this comment.
Table caption padding needs to match table cell padding. These variables do no exist currently and need to be applied with this update.
| --#{$table}--m-compact__tr__td--responsive--PaddingBlockEnd: var(--pf-t--global--spacer--xs); | ||
| --#{$table}--m-compact__check--responsive--MarginBlockStart: #{pf-size-prem(7px)}; | ||
| --#{$table}--m-compact__action--responsive--MarginBlockStart: calc(var(--pf-t--global--spacer--xs) * -1); | ||
| --#{$table}--m-compact__action--responsive--MarginBlockEnd: calc(var(--pf-t--global--spacer--xs) * -1); |
There was a problem hiding this comment.
These variables are no longer necessary as they are now part of the standardized cell--actions.
| // * Table cell action | ||
| --#{$table}--cell--action--PaddingBlockStart: var(--pf-t--global--spacer--sm); | ||
| --#{$table}--cell--action--PaddingBlockEnd: var(--pf-t--global--spacer--sm); | ||
| --#{$table}--cell--action--PaddingInlineStart: var(--pf-t--global--spacer--sm); | ||
| --#{$table}--cell--action--PaddingInlineEnd: var(--pf-t--global--spacer--sm); |
There was a problem hiding this comment.
--#{$table}__action has been abstracted to --#{$table}--cell--action and applied to all cells that contain interactive elements.
| --#{$table}--cell--PaddingBlockStart: var(--#{$table}__toggle--PaddingBlockStart); | ||
| --#{$table}--cell--PaddingBlockEnd: var(--#{$table}__toggle--PaddingBlockEnd); | ||
| --#{$table}--cell--PaddingInlineStart: var(--#{$table}__toggle--PaddingInlineStart); | ||
| --#{$table}--cell--PaddingInlineEnd: var(--#{$table}__toggle--PaddingInlineEnd); | ||
|
|
There was a problem hiding this comment.
Toggle no longer needs a specific padding as it belongs to the .#{$table}--cell--action group.
| --#{$table}--cell--PaddingInlineStart: var(--#{$table}__check--PaddingInlineStart); | ||
| --#{$table}--cell--PaddingInlineEnd: var(--#{$table}__check--PaddingInlineEnd); | ||
|
|
||
| vertical-align: top; | ||
|
|
||
| .#{$check} { | ||
| --#{$check}__label--FontSize: var(--#{$table}--cell--FontSize); | ||
| --#{$check}__label--LineHeight: var(--#{$table}--cell--LineHeight); | ||
| } | ||
|
|
||
| .#{$check}, | ||
| .#{$radio} { | ||
| --#{$radio}__label--FontSize: var(--#{$table}--cell--FontSize); | ||
| --#{$radio}__label--LineHeight: var(--#{$table}--cell--LineHeight); | ||
| } | ||
|
|
||
| thead & { | ||
| vertical-align: bottom; | ||
| } | ||
|
|
||
| .#{$check}.pf-m-standalone, | ||
| .#{$radio}.pf-m-standalone { | ||
| thead & { | ||
| display: table-cell; | ||
| height: auto; | ||
| line-height: 1; | ||
| vertical-align: baseline; | ||
| } |
There was a problem hiding this comment.
Special styling for __check is no longer necessary as its height has been standardized to table-_FontSize * table__LineHeight or 21px resulting in vertical alignment with all other elements.
| .#{$table}__thead & { | ||
| padding-block-start: 0; | ||
| padding-block-end: var(--#{$table}--cell--action--PaddingBlockEnd); | ||
| } |
There was a problem hiding this comment.
For thead .#{$table}--cell--action cells, only bottom padding needs to be applied in order to create consistent vertical alignment, as thead is set to vertical-align: bottom.
| .#{$table}__tbody & { | ||
| padding-block-start: var(--#{$table}--cell--action--PaddingBlockStart); | ||
| padding-block-end: 0; | ||
| } |
There was a problem hiding this comment.
For tbody .#{$table}--cell--action cells, only bottom padding needs to be applied in order to create consistent vertical alignment, as tbody is set to vertical-align: top.

























closes #7032
closes #11058
Updated Table Iso Backstop Report
Updated Full Backstop Report
Examples: https://patternfly-pr-7050.surge.sh/components/table
TLDR:
Floating
:first/:last-childpseudos result in a huge number of selector matching attempts. Attaching these pseudos to a selector results in a massive reduction in matching attempts.The cell padding and button fitting updates are the result of a somewhat hidden bug.
theadrow heights are affected erratically by using negative margining ontable__buttoncells. See below:Before
After
Table :first/:last-child css declarations are relics that should be standardized. As per a recent conversation w/ @lboehling, :first/:last-child th/td padding definitions can/should be simplified, while inset updates should be optional.Also, toggles, checkboxes, radios, actions, etc do not need special spacing.These need to be updated
Performance impact
This PR
Before
After
Before
After
Backstop report