Skip to content

[6.x] Make field ids unique across publish containers - #15682

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/unique-field-ids-across-containers
Oct 20, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/unique-field-ids-across-containers

Conversation

@mynetx

@mynetx mynetx commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

When a field lives inside a Bard or Replicator set, its settings open in a stack on top of the parent field's settings. Both stacks render fields with the same ids (field_instructions_position_1, field_sortable, ...), so clicking a label in the inner stack activates the hidden control in the outer one. Picking "Below" for Instructions Position silently changes the parent Bard field instead of the set field.

This adds the publish container's name to the field id so ids stay unique across stacked containers. Entry forms now render field_base_title instead of field_title, so anything selecting fields by the old id format would need updating.

Before (clicking "Below") After
15522-before.mp4
15522-after.mp4

@jasonvarga heads-up on that: this changes the DOM id of every field in the CP. Nothing in core relies on the old format, but addons or site browser tests that select fields like #field_title would break. Do you think that's okay, or would you rather keep the old ids on the main form and only namespace nested containers?

Fixes #15522

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga

Copy link
Copy Markdown
Member

Do you think that's okay, or would you rather keep the old ids on the main form and only namespace nested containers?

It's fine. Field ids are used for wiring up labels to their controls. They aren't intended to be used as hooks for styling/js/etc.

@jasonvarga
jasonvarga merged commit 392b194 into statamic:6.x Oct 20, 2026
62 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.

Unable to set instruction position for fields inside Bard sets

2 participants