taro
I’m trying to use native dialog tag for modal. It removes much boilerplating for modal functions. Instead of JS.show/1, it uses HTMLDialogElement.showModal method.
Problem is that it doesn’t survive LiveView update. If it has phx-update="ignore", LiveView destroys native modal setup and append it to its markup position, leaving it dangling out of its place.
Is there any possibility to correct this?
Native modal activated by
this.showModal()
Modal destroyed by LiveSocket
Modal appended (to an awkward place) by LiveSocket with
phx-update="ignore".
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Latest Phoenix Threads
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming














Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
tomkonidas
Can you show us your code?
The
phx-update="ignore"should be on a surrounding html element and not the actual thing you want to not be affected.So if you had:
change it to something like:
taro
Tried both ways, to a container and to itself. JS.dispatch makes the same result too.
tomkonidas
Why not handle it in the liveview?
In your LV:
taro
Native modal needs to be activated by
HTMLDialogElement.showModalmethod. It loses modal setup otherwise.Difference here is, Phoenix ships with hardcoded modal component, but instead I’m trying to use native modal
dialog.tomkonidas
In app.js:
In your Heex:
In your LV:
If you get that working, it still will erase your diag when the socket updates from something else? Just so I can understand the issue more.
taro
Same result, because your code has
phx-update="ignore", the modal gets appended to its markup position, instead of just disappearing.tomkonidas
What is the end result? Are you trying to close the modal? make it disappear? or persist it until the user closes it manually?
If it is to close it:
taro
So, on Send Link, data is submitted and LV updates, removing the modal by accident.
No. My goal here is modal not disappearing, because I could display error or do some multi-step communication.
@tomkonidas solution after submit
Ideal state after submit (No change on client, basically)
tomkonidas
I have not used dialog yet, have looked into it a bit but I would have thought this should work. Is there a repo I can pull down and try stuff out for myself? Or something that reproduces the error in a minimal way.
taro
UPDATE
Thanks for the support!
It turns out you are right.dialogworks as expected withphx-update="ignore".At the end of rabbit-holes, I’ve found out that iterating@flashmap was causing all the problem. This is seemingly irrelevant. The flash is not nested, not even close to mydialogelement.I still don’t understand this behaviour.UPDATE
I take that back. Any DOM update from LiveSocket that precedes a
dialog[phx-update=ignore], will break it.Aside from this bug, I think I shoud be able to save the status of the modal on
session. So I will try to work this way.https://github.com/phoenixframework/phoenix_live_view/issues/2433