Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent event bubbling on file upload targets (#3003)
In cases where an event is dispatched to `live_file_input` the event keeps triggering until a call stack error is raised: Uncaught RangeError: Maximum call stack size exceeded. This can be triggered with something like: <div phx-click={Phoenix.LiveView.JS.dispatch("click", to: "##{@uploads.image.ref}")}> Upload </div> <form style="display: none;" id="upload-form" phx-submit="save" phx-change="validate"> <.live_file_input upload={@uploads.image} /> <button type="submit">Upload</button> </form> To fix this, we set bubble to false if the event target is a file input.
- Loading branch information