Skip to content

Add dialog html tag.#244

Open
Johann-Goncalves-Pereira wants to merge 1 commit into
elm:masterfrom
Johann-Goncalves-Pereira:master
Open

Add dialog html tag.#244
Johann-Goncalves-Pereira wants to merge 1 commit into
elm:masterfrom
Johann-Goncalves-Pereira:master

Conversation

@Johann-Goncalves-Pereira

Copy link
Copy Markdown

Recently, the super useful HTML tag get full support as you can see:

So, I made this as an open-source contribution.

@BenAttenborough

Copy link
Copy Markdown

Be really cool if Elm ever got updates

@ultrox

ultrox commented Jun 20, 2023

Copy link
Copy Markdown

Untill this modules updates here is link how to implement it in user land with ports https://www.lindsaykwardell.com/blog/native-dialog-in-elm

@laurentpayot

Copy link
Copy Markdown

@ultrox I tried to use dialog as described in the Lindsay Wardell blog post. It works well but:

  • It uses one port.
  • You cannot close the modal by clicking outside it.
  • You cannot replay the modal opening in the debugger (opening does not depend on the model, although you could easily fix that).

I ended up using a custom element. There is an example in this Elm discourse post.

@lydell

lydell commented Dec 8, 2025

Copy link
Copy Markdown

The very latest browser versions as of this writing now support opening <dialog> as a modal without JavaScript!

https://ellie-app.com/xkSjz8LcJTSa1

https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API

That makes it more relevant to have Html.dialog. I guess we should add Html.Attributes.command and Html.Attributes.commandFor as well. Maybe Html.Events.onCommand and Html.Events.onClose.

Modal <dialog> is great for accessibility, since it prevents the user from accidentally tabbing outside the modal.

@laurentpayot

laurentpayot commented May 4, 2026

Copy link
Copy Markdown

Never mind. Developers AI agents use the popover API nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants