The Wayback Machine - https://web.archive.org/web/20190322164641/https://github.com/github/details-dialog-element
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
A modal dialog that's opened with a <details> button. https://github.github.io/details-dial…
Branch: master
Clone or download
Latest commit 9da29cd Mar 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.babelrc
.eslintrc.json
.flowconfig
.gitignore
.travis.yml Fix Travis headless Chrome runner Apr 4, 2018
LICENSE
README.md drop ie11 support Feb 25, 2019
index.css Add max width set to 90vw Jul 20, 2018
index.html Pull built file for pages demo and comment out local built file Aug 17, 2018
index.js
index.js.flow Set up Flow Aug 10, 2018
package-lock.json
package.json 2.0.1 Mar 21, 2019
prettier.config.js Initial commit Nov 24, 2017

README.md

<details-dialog> element

A modal dialog that's opened with a <details> button.

Installation

$ npm install --save details-dialog-element

Usage

import 'details-dialog-element'
<details>
  <summary>Open dialog</summary>
  <details-dialog>
    Modal content
    <button type="button" data-close-dialog>Close</button>
  </details-dialog>
</details>

Events

details-dialog:will-close

A details-dialog:will-close event is fired when a request to close the dialog is made either by pressing escape, clicking a data-close-dialog element, clicking on the <summary> element, or when .toggle(false) is called on an open dialog.

This event can be cancelled to keep the dialog open.

document.addEventListener('details-dialog:will-close', function(event) {
  if (!confirm('Are you sure?')) {
    event.preventDefault()
  }
})

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.