Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Last active December 24, 2015 14:39
Show Gist options
  • Save ryanflorence/6814517 to your computer and use it in GitHub Desktop.
Save ryanflorence/6814517 to your computer and use it in GitHub Desktop.

Context: http://updates.html5rocks.com/2013/09/dialog-element-Modals-made-easy

  1. show and close are not opposites. It should be open, close or show, hide. open close is the obvious winner.
  2. There is no declarative api, which is actually really simple:
<button controls="my-dialog">
  Toggle Dialog
</button>

<dialog id="my-dialog" open>
  Hello
  <button controls="my-dialog">close</button>
</dialog>

Using controls to mimic WAI ARIA aria-controls attribute. Could also use for.

@iammerrick
Copy link

I know people hate this when people +1 but... +1.

@OliverJAsh
Copy link

+1!

Have you lurked on the various mailing lists (WHATWG) to see what the deal is here?

@mfalken
Copy link

mfalken commented Oct 7, 2013

The <dialog> implementation in Chrome tries to follow the spec.

The show/close naming is being discussed on the WHATWG mailing list, with the main thread at the end of:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-September/040897.html
So far, the names remain as they are.

As pointed out on IRC and Twitter, <form method="dialog"> exists in the spec (but it's not yet implemented in Chrome). But there is no declarative way for an open button.

Providing feedback to the WHATWG mailing list or other channels can be a good way to influence changes to the spec.

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