Skip to content

fix: reserve space for sort indicator to prevent header layout shift (#995)#1132

Open
alpurkan17 wants to merge 3 commits into
entrius:testfrom
alpurkan17:fix/995-sort-layout-shift
Open

fix: reserve space for sort indicator to prevent header layout shift (#995)#1132
alpurkan17 wants to merge 3 commits into
entrius:testfrom
alpurkan17:fix/995-sort-layout-shift

Conversation

@alpurkan17
Copy link
Copy Markdown

@alpurkan17 alpurkan17 commented May 14, 2026

Summary

Clicking a sortable column header causes the header row to reflow because the TableSortLabel icon appears/disappears dynamically, pushing cell content and triggering width recalculation.

Add white-space: nowrap on the header cell to prevent text reflow, and reserve width: 18px for the sort icon (opacity 0 when inactive) so the space is always accounted for in the layout.

Validation

  • npm run lint — clean
  • npm run test — 27 passed

Closes #995

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 14, 2026
@alpurkan17
Copy link
Copy Markdown
Author

@anderdc @LandynDev ready for review

@anderdc anderdc added enhancement New feature or request and removed bug Something isn't working labels May 15, 2026
Copy link
Copy Markdown
Collaborator

@anderdc anderdc left a comment

Choose a reason for hiding this comment

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

Please scope this down to what #995 asks for. Keep: the DataTable.tsx sort-indicator fix — whiteSpace nowrap on the header cell and the TableSortLabel icon opacity/width sx. Drop: the linkBehavior.tsx LinkTableRow rewrite and the getRowHref JSDoc change in DataTable.tsx. Those are unrelated to #995 — and they're the same LinkTableRow change as PR #1130 / issue #1127, which were closed as not planned.

@alpurkan17
Copy link
Copy Markdown
Author

@anderdc changes addressed per your review. Commit e634a1c scoped the PR down to only the DataTable.tsx sort-indicator fix (7 lines). LinkTableRow changes have been dropped. Please re-review.

@alpurkan17
Copy link
Copy Markdown
Author

alpurkan17 commented May 16, 2026

Scoped down per review — DataTable.tsx sort-indicator fix only, linkBehavior.tsx removed.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: table header layout shifts when sorting columns

2 participants