Repository navigation
[Autocomplete] Only add the clear button to a select that has an empty option - #4203
Merged
Merged
Conversation
Contributor
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
|||||||||
…y option | Q | A | -------------- | --- | Bug fix? | yes | New feature? | no | Deprecations? | no | Documentation? | no | Issues | Fix symfony#402 | License | MIT The Autocomplete controller adds Tom Select's clear button to every enabled single select. A required `ChoiceType` without a placeholder has no empty option, and Symfony also removes the `required` attribute from its `<select>`. So the user can clear the field and submit an empty value, which a native `<select>` does not allow. The controller now adds the clear button only when the `<select>` has an option with an empty value, i.e. a placeholder. You can still enable or disable `clear_button` explicitly with the `plugins` key of `tom_select_options`. This follows the approach of the earlier pull request symfony#2282 by Ruud Seberechts (@Qronicle), which was never merged. | Field | Before | After | | --- | --- | --- | | Required, no plac 8000 eholder | Clear button | No clear button | | Required, with placeholder | Clear button | Clear button | | Not required | Clear button | Clear button |
Kocal
force-pushed
the
autocomplete/clear-button-placeholder
branch
from
November 3, 2026 17:28
1745213 to
833d27f
Compare
Member
Author
|
Thank you @Qronicle. |
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.
The Autocomplete controller adds Tom Select's clear button to every enabled single select. A required
ChoiceTypewithout a placeholder has no empty option, and Symfony also removes therequiredattribute from its<select>. So the user can clear the field and submit an empty value, which a native<select>does not allow.The controller now adds the clear button only when the
<select>has an option with an empty value, i.e. a placeholder. You can still enable or disableclear_buttonexplicitly with thepluginskey oftom_select_options.This follows the approach of the earlier pull request #2282 by Ruud Seberechts (@Qronicle), which was never merged.