Skip to content

fix(table): targeted control-row sort button margining#7244

Closed
mattnolting wants to merge 7 commits intopatternfly:mainfrom
mattnolting:fix-table-thead-cells
Closed

fix(table): targeted control-row sort button margining#7244
mattnolting wants to merge 7 commits intopatternfly:mainfrom
mattnolting:fix-table-thead-cells

Conversation

@mattnolting
Copy link
Collaborator

@mattnolting mattnolting commented Dec 3, 2024

closes #7220

TLDR: Issue is being caused by table sort vertical alignment (should be vertical-align: top) in tbody and negative margining.

Backstop report

Because tables may contain elements with varying line-height/font-size, all th/td cells, whether in thead or tbody require a consistent and explicit line-height to properly align vertically.

@patternfly-build
Copy link
Collaborator

patternfly-build commented Dec 3, 2024

@mcoker mcoker requested review from mcoker and sg00dwin December 3, 2024 20:25
@mattnolting mattnolting force-pushed the fix-table-thead-cells branch from fb0eb0c to 708c656 Compare December 3, 2024 22:59
padding-inline-end: var(--#{$table}--cell--first-last-child--PaddingInline);

.#{$table}__button {
margin-inline-end: calc((var(--#{$table}--cell--first-last-child--PaddingInline) - var(--#{$table}--cell--PaddingInlineend)) * -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
margin-inline-end: calc((var(--#{$table}--cell--first-last-child--PaddingInline) - var(--#{$table}--cell--PaddingInlineend)) * -1);
margin-inline-end: calc((var(--#{$table}--cell--first-last-child--PaddingInline) - var(--#{$table}--cell--PaddingInlineEnd)) * -1);

@sg00dwin
Copy link
Contributor

sg00dwin commented Dec 4, 2024

@mattnolting I noticed that the table th sortable button text and the nested table first column is no longer left aligned like other table elements.
https://patternfly-pr-7244.surge.sh/components/table/html/compound-expansion-example/
https://www.patternfly.org/components/table/html/compound-expansion-example/

Screenshot 2024-12-04 at 12 52 36 PM

@sg00dwin sg00dwin self-requested a review December 4, 2024 18:04
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. The line-height change could have some larger repercussions since anything in a cell that inherits line-height will no longer be relative to the text size of whatever is in the cell.

Also it may be related to @sg00dwin's comment, but the first "Source" table header in this demo is no longer left-aligned https://patternfly-pr-7244.surge.sh/components/table/html/nested-column-headers-example/

Screenshot 2024-12-04 at 12 38 57 PM

Also can you show how the original misalignment bug in #7220 applies to all tables, not just nested tables? Either a codepen/codesansbox or steps to reproduce like the steps in #7220.

--#{$table}--cell--hidden-visible--Display: table-cell;

// * Table toggle
--#{$table}__toggle--PaddingBlockStart: var(--pf-t--global--spacer--sm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you meant to remove this? It's breaking to remove it, and it looks like it's still used here

--#{$table}--cell--PaddingBlockStart: var(--#{$table}__toggle--PaddingBlockStart);


// * Table toggle
--#{$table}__toggle--PaddingBlockStart: var(--pf-t--global--spacer--sm);
--#{$table}__toggle--PaddingBlockEnd: var(--pf-t--global--spacer--sm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar issue with this one - it's still used here

--#{$table}--cell--PaddingBlockStart: var(--#{$table}__toggle--PaddingBlockStart);

And then redefined here

--#{$table}__toggle--PaddingBlockEnd: var(--#{$table}__thead__toggle--PaddingBlockEnd);

// TODO: update grouping comments to // * Table {element}

@include pf-root($table) {
--#{$table}--LineHeight: calc(var(--pf-t--global--font--line-height--body) * var(--pf-t--global--font--size--body--default));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is applied to cells, any text in a cell that 1) is not font--size--body--default and 2) inherits line-height will have the wrong line-height. Our empty state demo shows this - https://patternfly-pr-7244.surge.sh/components/table/html-demos/empty-state/

empty-state__body font size is 16px and the line-height is 21px now (14px * 1.5) instead of 24px.

@mcoker
Copy link
Contributor

mcoker commented Dec 6, 2024

Closing this PR - #7220 was closed via #7246

@mcoker mcoker closed this Dec 6, 2024
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.

Bug - Table - misalignment when only some headers are sortable

5 participants