fix(tags-input): sync hidden input on value change for native form submit#3194
Merged
Conversation
…bmit Wire dispatchChangeEvent when tags change so FormData reflects the current value instead of staying frozen at mount time (fixes #3193). Adds a form example, e2e coverage, and shared clickButton/seeTextValue model helpers.
🦋 Changeset detectedLatest commit: 280b37f The changes in this PR will be included in the next version bump. This PR includes changesets to release 86 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3193
Summary
Native
<form>submit now sends the current tags fromTagsInput.After adding, removing, or clearing tags,
FormData.get("tags")stayed at the initial value. WithdefaultValue={["a"]}, adding"b"and submitting sent"a"instead of"a, b". The hidden input's DOM.valuenever updated even though React refreshed thevalueattribute.This wires the existing
dispatchChangeEventaction into avalueAsStringwatcher (same pattern asselect), syncing the hidden input via the native value setter on every tag change.Test plan
tags-input / formadd, remove, and clear tags then assert submitted value@ark-ui/react@5.37.2repro: stale.valuebefore fix,"a, b"after