Fix ID collision in FormTokenField suggestions list#24
Fix ID collision in FormTokenField suggestions list#24Copilot wants to merge 2 commits intofeature/form-token-fieldfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: flexseth <3792502+flexseth@users.noreply.github.com>
|
@copilot has this been merged? |
Can we make a standard for components, such that if there is more than one on a page, they will not collide? I will approve this PR, and merge. @copilot - Please make a new PR to add the anti-collision method to all other components, can you do that? |
flexseth
left a comment
There was a problem hiding this comment.
This is a feature fix when trying to create a single post or page with multiple components of the same type on it. Should extend beyond just this component, we will address the PR in the future as the plugin UI starts working better.
Hardcoded
id="ftf-suggestions"breaks ARIA associations and violates HTML uniqueness when multipleFormTokenFieldinstances exist on the same page.Changes
suggestionsId— derived fromlabelprop using the codebase-standard pattern; sanitizes to[a-z0-9-_]to produce valid HTML IDsuseId()fallback — uses React 18'suseId()when nolabelis provided, guaranteeing per-instance uniquenessaria-controlson<input>andidon the suggestions<ul>💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.