A modal dialog that's opened with <details>.
A modal dialog that's opened with <details>.
A modal dialog opened with a <details> button.
This web component has been deprecated. There are a number of accessibility concerns with this approach and so we no longer recommend using this component.
GitHub are moving towards using a dialog Primer View Component which enforces certain aspects of the design (such as always having a close button and a title).
Available on npm as @github/details-dialog-element.
$ npm install --save @github/details-dialog-element
Import as ES modules:
import '@github/details-dialog-element'
Include with a script tag:
Open dialog
Modal content
Close
Dialog content can be loaded from a server by embedding an [``][fragment] element.
Robots
Loading…
The src attribute value is copied to the the first time the button is toggled open, which starts the server fetch.
If the preload attribute is present, hovering over the `` element will trigger the server fetch.
details-dialog-closedetails-dialog-close event is fired from `` when a request to close the dialog is made from
form[method="dialog"]summary, form button[formmethod="dialog"], [data-close-dialog], ordialog.toggle(false)This event bubbles, and can be canceled to keep the dialog open.
document.addEventListener('details-dialog-close', function(event) {
if (!confirm('Are you sure?')) {
event.preventDefault()
}
})
Browsers without native custom element support require a polyfill.
Distributed under the MIT license. See LICENSE for details.
No open issues yet, or sync has not completed.