themesberg / themesberg/flowbite
Closing a Modal whose close button is in an HTML content located elsewhere inserted into the DOM via HTMX
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
<form hx-post="{% url 'my_nice_url' %}" hx-target="this" hx-swap="innerHTML">
{% include "../partials/some-form.html" %}
</form>
In some-form.html I have :
<div>
<button type="submit">Update</button>
<button data-modal-hide="modal-myModal" type="button">Close</button>
</div>
If I click the update button, I'll get the confirmation displayed via HTMX and it contains a close button - close button being :
<button data-modal-hide="modal-myModal" type="button">Close</button>
But clicking on the close button on form POST doesn't close the form.
Is this because the button is located in a file elsewhere which get updated into the DOM via HTMX ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the form and partial snippets shown, including the HTMX innerHTML swap and the data-modal-hide button. Start by inspecting Flowbite’s modal close handling and how it finds buttons after DOM replacement; done means the close button in the swapped content closes the modal reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript, tailwindcss
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100