[v4] Inactive document tabs use the ghost button color on Next.js (no Lexical): the `.doc-tab` color depends on stylesheet order
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- next.js, react, typescript
Research direction
Read packages/ui/src/elements/DocumentHeader/Tabs/Tab/index.css, packages/ui/src/elements/Button/index.css, and packages/ui/bundle.js to trace how the competing rules enter the Next.js stylesheet. Reproduce with the linked Next.js setup without Lexical and inspect the computed color of an inactive tab. Done when inactive tabs use --color-text-secondary across the described bundler and stylesheet-order cases.
Written by the indexing model from the issue text.
Description
Describe the Bug
On Next.js, inactive document tabs ("Versions", "API" next to the active "Edit") render in --color-text, so they look as strong as the active tab. On TanStack Start, the same tabs render in --color-text-secondary, as intended. The markup and classes are the same in both:
<a class="btn doc-tab btn--size-medium btn--withoutPopup btn--no-margin btn--style-ghost btn--withoutPopup" aria-current="false">
Two rules with equal specificity set the color, and both are in @layer payload-default:
.doc-tab { color: var(--color-text-secondary) },DocumentHeader/Tabs/Tab/index.css#L2-L8.btn--style-ghost { color: var(--color-text) },Button/index.css#L141-L142. Inactive tabs get it fromTabLink.tsx#L66(buttonStyle={isActive ? 'pill' : 'ghost'}).
So whichever stylesheet comes last wins. Here is the order on Next:
RootLayoutimports@payloadcms/ui/css/app.css(layouts/Root/index.tsx#L14).- That file runs
@import '../styles.css'(css/app.css#L3). dist/styles.cssis built bybundle.jsfrom thesrc/exports/client/index.tsgraph only (bundle.js#L74-L104). It contains the Button CSS, ghost rule included. It does not containDocumentHeader/Tabs/Tab/index.css, because the tabs aren't reachable from the client export. In 4.0.0-beta.7, 52 of the 334 component CSS files indist/are missing fromstyles.css.- Turbopack emits the per-component CSS (
Tab/index.css) before the layout'sapp.css→styles.css. So.btn--style-ghostcomes after the last.doc-tab, and the tab turns--color-text.
TanStack Start links app.css first and the component CSS after it, so .doc-tab wins there.
Most apps don't see this, because @payloadcms/richtext-lexical loads field/bundled.css. That file has another full copy of the UI CSS, .doc-tab included, after the ghost rule. Apps without Lexical (or whose pages don't pull it in) get the dark tabs.
Measured on the edit view, dark theme. --color-text is #fff and --color-text-secondary is #ffffffb3.
| App | "Versions" / "API" color | Last relevant rule in the sheet |
|---|---|---|
| Next dev, no Lexical (repro branch) | rgb(255, 255, 255) |
.btn--style-ghost from ui/dist/styles.css |
| Next dev, with Lexical (repro baseline) | rgba(255, 255, 255, 0.7) |
.doc-tab from richtext-lexical/dist/field/bundled.css |
| TanStack Start dev, no Lexical | rgba(255, 255, 255, 0.7) |
.doc-tab from Tab/index.css (after app.css) |
Next.js, no Lexical (bug):
TanStack Start, same config (expected):
Expected: inactive tabs are --color-text-secondary regardless of bundler, stylesheet order, or whether Lexical is installed.
Link to the code that reproduces this issue
https://github.com/VeiaG/payload-4-reproductions/tree/repro-doc-tab-color-css-order
Reproduction Steps
The only change from the baseline: the Lexical editor and the richText field on posts are removed, and the import maps are regenerated.
pnpm install, thenpnpm devinapps/next.- Open any post, e.g. create one and open its edit view.
- "Versions" and "API" are as bright as the active "Edit". In devtools, the winning
coloron the inactive tab is.btn--style-ghostfrom@payloadcms/ui/dist/styles.css, which overrides.doc-tab. - Run
apps/tanstack(pnpm dev) with the same config and open the same view. The inactive tabs are dimmed.
Which area(s) are affected?
area: ui
Environment Info
payload: 4.0.0-beta.7
@payloadcms/ui: 4.0.0-beta.7
@payloadcms/next: 4.0.0-beta.7
@payloadcms/tanstack-start: 4.0.0-beta.7
next: 16.4.4 (Turbopack, dev)
Node: 24
Browser: Chrome
- Dominant language
- TypeScript
- Stars
- 45.8k
- Forks
- 4.4k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 251
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Document bar (.doc-controls__content) overflows a 375 px viewport, clips "Created" and fails axe scrollable-region-focusablePossibly taken A pull request linked to this issue is open or already merged. Openarea: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#19690 ·
Maintainers usually reply within 1 day
-
[v4] Blocks thumbnails croped 3:2Possibly taken @samiarif02 claimed this 2 days ago. Openarea: ui Bug Payload OSS status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
payloadcms/payload#19609 ·
Maintainers usually reply within 1 day
-
Scheduled publish jobs are not deleted when their document is deleted (string id in the job, raw id in the cleanup)Possibly taken @volodymyrshk claimed this 10 days ago. Openarea: core Bug db: sqlite
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19448 ·
Maintainers usually reply within 1 day
-
plugin-multi-tenant: `isGlobal` collections redirect tenant-scoped users to `/admin` since 3.93.0 (GlobalViewRedirect prop-name mismatch)Possibly taken @JarrodMFlesch claimed this 10 days ago. OpenBug plugin: multi-tenant
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19420 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
milind-soni/OpenMausBot#6730 ·
Maintainers usually reply within 1 day
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:image documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day