payloadcms / payloadcms/payload

Table Header Misalignment with orderable: true

Open Beginner friendly
#16,251 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: ui stale status: needs-triage
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug.

Description: When orderable: true is enabled, the collection table headers misalign with the body columns. This occurs because the drag-handle column in the thead does not match the width of the corresponding td in the tbody.

Root Cause: The class .sort-row__icon (the SVG drag handle) has width: min-content in the default @layer payload-default styles. This prevents the browser from correctly calculating a consistent column width before the SVG is fully rendered, leading to a layout shift in the table grid.

For fix:

 .sort-row__icon {
    width: auto !important;
  }

Custom styles imported via layout.tsx (e.g., import './custom.scss') only apply correctly during Hot Module Replacement (HMR). Upon a full page refresh (F5), the styles are either not loaded or are overridden by Payload's internal CSS.

Reproduction Steps

orderable: true

Environment Info
Payload: 3.82.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the .sort-row__icon rule in the payload-default styles and the custom stylesheet import in layout.tsx. Reproduce a collection with orderable: true, compare the drag-handle header and body columns after a full refresh, and confirm they remain aligned without relying on HMR.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.