[Toolkit][Flowbite] Rename the modal Stimulus controller to avoid a collision with Flowbite - #3842
Merged
Merged
Conversation
…ollision with Flowbite | Q | A | -------------- | --- | Bug fix? | yes | New feature? | no | Deprecations? | no | Documentation? | no | Issues | Fix symfony#3742 | License | MIT The `modal` recipe registered a Stimulus controller named `modal`, so its targets and values rendered as `data-modal-target` and `data-modal-open-value`. Flowbite's own JavaScript already uses `data-modal-target`, where it expects the id of the dialog to open. Loading both on the same page makes Flowbite scan the markup, find `data-modal-target="trigger"` and `data-modal-target="modal"`, fail to resolve them as ids, and log two errors on every page that renders a modal: ``` Modal with id trigger does not exist. Are you sure that the data-modal-target attribute points to the correct modal id? Modal with id modal does not exist. ... ``` The controller is renamed to `flowbite-modal`, which moves its attributes to `data-flowbite-modal-target` and `data-flowbite-modal-open-value` and leaves `data-modal-target` to Flowbite. The recipe is copied into the user's application at install time, so applications that already installed it keep their own consistent copy and are not affected. Only the modal recipe was affected: the `alert`, `dropdown` and `tabs` controllers do not collide, since Flowbite keys those off `data-dropdown-toggle` and `data-tabs-toggle`, which the recipes never emit.
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
modalrecipe registered a Stimulus controller namedmodal, so its targets and values rendered asdata-modal-targetanddata-modal-open-value. Flowbite's own JavaScript already usesdata-modal-target, where it expects the id of the dialog to open. Loading both on the same page makes Flowbite scan the markup, finddata-modal-target="trigger"anddata-modal-target="modal", fail to resolve them as ids, and log two errors on every page that renders a modal:The controller is renamed to
flowbite-modal, which moves its attributes todata-flowbite-modal-targetanddata-flowbite-modal-open-valueand leavesdata-modal-targetto Flowbite. The recipe is copied into the user's application at install time, so applications that already installed it keep their own consistent copy and are not affected.Only the modal recipe was affected: the
alert,dropdownandtabscontrollers do not collide, since Flowbite keys those offdata-dropdown-toggleanddata-tabs-toggle, which the recipes never emit.