Skip to content

[6.x] Fix Replicator field labels hidden when nested in Grid#14987

Merged
jasonvarga merged 2 commits into
statamic:6.xfrom
lazerg:fix/issue-14049-replicator-grid-labels
Jul 15, 2026
Merged

[6.x] Fix Replicator field labels hidden when nested in Grid#14987
jasonvarga merged 2 commits into
statamic:6.xfrom
lazerg:fix/issue-14049-replicator-grid-labels

Conversation

@lazerg

@lazerg lazerg commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Fixes issue #14049 where Replicator field labels were hidden when the Replicator was nested inside a Grid field.

The CSS rule in grid.css that hides field labels for direct grid cell children was too broad and also hiding labels for fields inside nested container fieldtypes like Replicator, Bard, and Group. This fix uses a counter-rule to make labels visible again inside these container fieldtypes.

Fixes #14049

@lazerg

lazerg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@jasonvarga CI just went green on this one, so it's ready for a look whenever you get a chance.

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I ran an AI review on this. Havent't had a chance to actually test this out myself yet. Wasn't going to drop a review until then but since you've pinged...

Added CSS override may re-reveal labels in deeper nesting it shouldn't

The new selector matches [data-ui-field-header] /etc. as a descendant of  .replicator-fieldtype / .bard-fieldtype / .group-fieldtype  at any depth, not just direct fields of that container. Scenario: outer Grid → Replicator (in a cell) → an inner Grid field → the inner grid's own cell direct-child label. That inner label is still a descendant of  .grid-cell :is(.replicator-fieldtype ...) , so the override rule (higher specificity) wins over the inner grid-cell's own "hide direct labels" rule, un-hiding a label that should stay hidden per the original grid-cell design. This is a plausible (if narrow/rare) regression for Grid-inside-Replicator-inside-Grid nesting. Not covered by any test. Worth a quick manual check in the browser before merge, but likely acceptable given how narrow the case is.

The PHPUnit test adds nothing

The fix is a CSS thing. Adding PHP coverage does nothing here and would pass even before this PR. Please remove.

@lazerg

lazerg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Good catch on both. On the nesting one, you're right: I traced the specificity, and the override rule doesn't tell "directly inside this container" apart from "nested another Grid level deeper." So a Replicator/Bard/Group's un-hide rule beats an inner Grid cell's own hide rule no matter how deep it goes.

I added a third rule that re-hides labels once they're inside another .grid-cell nested within the container fieldtype. Checked it against your exact scenario plus the original case, both work now, and ran it through a real build to make sure the compiled selector is right. I don't have a way to eyeball it in a live browser myself, though, so it's still worth a manual pass on your end.

Also pulled the PHPUnit test. You're right that it wasn't covering anything: it passes the same with or without the CSS change, confirmed by reverting just the CSS and rerunning it. Pushed both fixes.

@jasonvarga jasonvarga merged commit 5a2b40a into statamic:6.x Jul 15, 2026
19 checks passed
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.

Labels not showing in Replicator sets nested in Grid fields

2 participants