HTML Can Do That

HTML has been gobbling up swathes of what used to be JavaScript’s remit. This page lists a bunch of dynamic functionality that we can now achieve with just HTML.

Update2026-08-20: I originally built this page in one hour duringHTML Day 2026to write and celebrate HTML, but I’ve since made some edits to better express and highlight where the browser implementation of some of this stuff is severely lacking and/or completely fails to meet accessibility needs. So, by all means, try it out, butmake it as accessible as you can!

Light dismiss,Escto close, no managingz-indexto wrangle it onto a top later. All managed withpopoverandpopovertarget(andpopovertargetaction) attributes in HTML. (MDN)

No JavaScript, just modern browser magic, thanks to the wonderful folks speccing for the web and building our browsers!

Similar thing going on aspopoverhere, except this time with a dedicated element for modal dialog boxes. (MDN)

Seecommand/commandForbelow for another, more recently-landing feature that allows us to open and close dialog elements (and will be useful for lots of other non-JS functionality, one day!).

Once again thepopoverattribute is doing some heavy-lifting here!

Even though it’s sort of against the spirit of this page, I want to include this short snippet of how to interact with dialog elements in JavaScript:

This one is opened with.showModal()and closed with.close(), both called from JavaScript.

Open the seond one and watch this close on its own.

Separate HTML buttons controllingonepopover. No scripting. (MDN)

Note:So far onlyshow-modal,close,request-close,toggle-popover,show-popover, andhide-popoverhave landed stable in browsers. We can look forward to invokers supported in the future to increment/decrement values, interact with media elements, copy text, etc.