Testing

HTML Dialog: Browser Support, Features, Known Issues

The HTML dialog element works in Chrome 37+, Edge 79+, Firefox 98+, Safari 15.4+, Opera 24+, Samsung Internet 4+. See methods, attributes, and known issues.

Author

Prince Dewani

May 6, 2026

The HTML <dialog> element is a WHATWG element that shows a modal or non-modal dialog box, with showModal(), show(), and close() methods plus a ::backdrop pseudo-element. It works in Chrome 37+, Edge 79+, Firefox 98+, Safari 15.4+, Opera 24+, and Samsung Internet 4+, while Internet Explorer and Opera Mini never added support.

This guide covers what the dialog element is, the browsers that support it, the key features, known issues, opening and closing it, and how it compares to popover.

What is HTML Dialog?

The HTML <dialog> element is an interactive element from the WHATWG HTML Living Standard that shows a dialog box on a web page. It supports a modal mode through showModal(), a non-modal mode through show(), and a close() method, and modal dialogs paint in the top layer with a ::backdrop pseudo-element.

Which browsers does HTML Dialog support?

The HTML <dialog> element works in every modern desktop and mobile browser, but support starts at very different versions across vendors and was disabled by default in Chrome and Firefox for many releases before becoming a stable feature.

Loading browser compatibility data...

HTML Dialog compatibility in Chrome

Chrome supports the <dialog> element from Chrome 37 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 32 to 36 had it disabled by default behind the Experimental Web Platform Features flag, and Chrome 4 to 31 did not support it. The closedby attribute and the :open pseudo-class work from Chrome 134 on.

HTML Dialog compatibility in Edge

Microsoft Edge supports the <dialog> element from Edge 79 on Windows, macOS, and Linux. Legacy EdgeHTML 12 to 18 did not support the element. Chromium-based Edge 79 and later inherits every Chrome dialog feature, including showModal(), the ::backdrop pseudo-element, and form method="dialog" submission.

HTML Dialog compatibility in Firefox

Firefox supports the <dialog> element from Firefox 98 on Windows, macOS, Linux, and Android. Firefox 53 to 97 had it disabled by default behind the dom.dialog_element.enabled preference, and Firefox 2 to 52 did not support it. Firefox 137 added the closedby attribute and the :open pseudo-class.

HTML Dialog compatibility in Safari

Safari supports the <dialog> element from Safari 15.4 on macOS Monterey and from iOS Safari 15.4 on iPhone and iPad. Safari 3.1 to 15.3 on macOS and iOS Safari 3.2 to 15.3 did not support the element. Safari 18.2 added the closedby attribute on macOS, iOS, and iPadOS.

HTML Dialog compatibility in Opera

Opera supports the <dialog> element from Opera 24 on Windows, macOS, and Linux. Opera 19 to 23 had it disabled by default behind a flag, and Opera 9 to 18 did not support it. Chromium-based Opera 15 and later tracks every Chrome dialog feature, while Opera Mini never added support and falls back to a generic block element.

HTML Dialog compatibility in Samsung Internet

Samsung Internet supports the <dialog> element from Samsung Internet 4.0 on Galaxy phones and tablets. Samsung Internet inherits the Chromium dialog stack, so showModal(), show(), close(), the ::backdrop pseudo-element, and form method="dialog" all work the same way they do in desktop Chrome.

HTML Dialog compatibility in Android Browser

Modern Chrome for Android replaced the stock Android Browser on Android 4.4 and later, so <dialog> works on every shipping Android device through Chrome for Android 37 and later. The legacy Android Browser 2.1 to 4.4.4 did not support the element. KaiOS Browser 2.5 and 3 also do not support it and fall back to a generic block element.

HTML Dialog compatibility in Internet Explorer

Internet Explorer never supported the <dialog> element. Internet Explorer 5.5 to 11 render the markup as a generic block-level element with no top-layer behaviour, no modal mode, and no ::backdrop. Microsoft has retired Internet Explorer, so move IE-only dialogs to Chromium Edge or use a polyfill like dialog-polyfill on legacy intranets.

Note

Note: HTML dialog support varies across Chrome 37, Firefox 98, Safari 15.4, and the new closedby attribute. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

What are the key features of HTML Dialog?

The <dialog> element wraps a small set of methods, attributes, events, and CSS hooks that handle modality, dismissal, and styling without any custom JavaScript. The headline features focus on top-layer placement, native dismissal, and form integration.

  • showModal() method: Opens the dialog modally, marks the rest of the page inert, and stacks the dialog in the top layer above any z-index. The browser fires a cancel event when the user presses Escape.
  • show() method: Opens the dialog non-modally without a backdrop, leaves the rest of the page interactive, and is the right choice for inspector panels and toasts that should not block input.
  • close() and returnValue: Closes the dialog, fires the close event, and stores an optional string in dialog.returnValue. Form method="dialog" calls close() automatically with the submitter's value.
  • ::backdrop pseudo-element: Paints behind a modal dialog in the top layer. Use it for blur, dim, or fade-in effects, and animate it through the display property when paired with transition-behavior: allow-discrete.
  • :modal and :open pseudo-classes: :modal matches a dialog opened by showModal(), and :open matches any open dialog from Chrome 134, Edge 134, Firefox 137, and Safari 17.4 on.
  • closedby attribute: Accepts any, closerequest, or none and controls whether clicking the backdrop or pressing Escape closes the dialog. Works in Chrome 134, Edge 134, Firefox 137, and Safari 18.2 on.
  • form method="dialog": Closes a parent <dialog> on submit and posts the submitter's value to dialog.returnValue instead of issuing a network request.
  • autofocus and inert: Setting autofocus on a child input moves keyboard focus into the dialog on open, and the rest of the page becomes inert automatically when showModal() runs.

What are the known issues with HTML Dialog across browsers?

HTML dialog support is broad now, but a handful of cross-browser quirks still bite teams that ship modals on legacy stacks or rely on the newest attributes. Most fixes are small once you know which browser is missing the feature.

  • closedby attribute is new: Chrome 134, Edge 134, Firefox 137, and Safari 18.2 added the attribute. Older browsers fall back to listening for the cancel event and calling close() from a backdrop click handler.
  • Internet Explorer and Opera Mini never supported it: IE 5.5 to 11 and every Opera Mini version render <dialog> as a block element with no modality, no ::backdrop, and no top-layer behaviour. Use dialog-polyfill or stop targeting these browsers.
  • Animating display needs allow-discrete: Chrome 116, Firefox 129, and Safari 17.4 added transition-behavior: allow-discrete, which is required to animate the display property when opening or closing a dialog. Older browsers snap the dialog in and out.
  • ::backdrop animation lagged in Firefox: Firefox painted the ::backdrop immediately for several releases before honouring opacity transitions. Firefox 110 and later runs the backdrop transition correctly.
  • iOS Safari leaks scroll on the body: iOS Safari 15.4 to 16.3 let touch scroll events pass through a modal dialog so the body scrolled behind the backdrop. Safari 16.4 fixed it; older iOS still needs body { overflow: hidden } on open.
  • Initial focus lands on the dialog: When no element inside the dialog has autofocus, Chrome and Firefox park focus on the dialog itself. Add autofocus to the primary action so screen readers announce the right control.
  • open attribute is not interchangeable with show(): Setting the open attribute by hand shows a non-modal dialog without firing the cancel event and without putting the dialog in the top layer. Always call show() or showModal() instead.
  • tabindex on the dialog is non-conforming: WHATWG forbids tabindex on <dialog> because the focus ring is managed automatically. Browsers ignore the attribute, and screen readers may announce a wrong tabbable target.

In my experience, the loudest dialog bug on real-device runs is iOS Safari 15.4 letting the page scroll behind a showModal() modal on iPhone, because the backdrop fires touchmove through to body. The fix is to call event.preventDefault() on the dialog's touchmove listener until you can drop iOS 16.3 and earlier.

...

How do you open and close an HTML dialog?

You open and close an HTML dialog by calling its showModal(), show(), or close() methods from JavaScript, or by submitting a form with method="dialog". The steps below open a modal, capture a return value, and close it on confirm.

  • Mark up the dialog: Add a <dialog id="confirm-delete"> block with a heading, body copy, and a <form method="dialog"> containing a Cancel and a Delete button.
  • Open the dialog modally: Call dialog.showModal() from a click handler on the trigger button. The browser places the dialog in the top layer, paints a ::backdrop, and makes the rest of the page inert.
  • Wire up the close path: Set a value on each form button (<button value="cancel">, <button value="delete">) so submitting the form closes the dialog and writes the value to dialog.returnValue.
  • Read the return value: Listen for the close event on the dialog and branch on dialog.returnValue. Trigger the destructive action only when the value is "delete".
  • Handle Escape with cancel: Modal dialogs fire a cancel event when the user presses Escape. Call event.preventDefault() inside the listener if you need to keep the dialog open until validation passes.
  • Confirm support before opening: Wrap the call site with if (typeof dialog.showModal === "function") so older browsers fall back to a polyfill or to a window.confirm prompt instead of throwing.

Paste this snippet into the DevTools console of any modern browser to mount a confirm dialog and read the return value.

// Mounts a confirm dialog, opens it modally, and logs the user's choice.
const dialog = document.createElement("dialog");
dialog.innerHTML = `
  <p>Delete this item permanently?</p>
  <form method="dialog">
    <button value="cancel">Cancel</button>
    <button value="delete">Delete</button>
  </form>
`;
document.body.appendChild(dialog);

dialog.addEventListener("close", () => {
  console.log("returnValue:", dialog.returnValue);
});

if (typeof dialog.showModal === "function") {
  dialog.showModal();
} else {
  console.log("HTML <dialog> showModal() is not supported in this browser.");
}
...

What is the difference between HTML dialog and popover?

The <dialog> element and the popover attribute both place content in the browser top layer, but they target different UX patterns. <dialog> is the right choice for modal confirmations and forms, while popover covers tooltips, menus, and lightweight overlays.

DimensionHTML <dialog>popover attribute
Element typeStandalone interactive HTML elementGlobal attribute on any element
Spec bodyWHATWG HTML Living StandardWHATWG HTML Living Standard
Modal modeshowModal() locks the page and paints a ::backdropAlways non-modal; the page stays interactive
Default dismissalclosedby attribute, Escape key, or close() methodpopover="auto" closes on Escape and outside click
Form integrationform method="dialog" closes the dialog and stores returnValueNo native form integration
Browser supportChrome 37+, Firefox 98+, Safari 15.4+Chrome 114+, Firefox 125+, Safari 17+
Best forConfirmations, alerts, blocking forms, wizardsTooltips, menus, hint cards, anchored UI

Citations

All HTML dialog version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests