Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the <dialog> tag #73

Open
craigfrancis opened this issue Oct 17, 2016 · 2 comments
Open

Using the <dialog> tag #73

craigfrancis opened this issue Oct 17, 2016 · 2 comments

Comments

@craigfrancis
Copy link

You could look at the HTML5 dialog tag, as it will give much better symantics for assistive devices (or simply the browser) to use.

For example, when the dialog is "open" and "modal", supporting browsers will limit the focusable controls to those elements within the dialog (e.g. tabbing between elements won't focus anything else on the page, so you don't need to do anything in JS to fix that).

https://github.com/GoogleChrome/dialog-polyfill

https://developer.mozilla.org/en/docs/Web/HTML/Element/dialog

@danhumaan
Copy link
Collaborator

Thanks for sharing @craigfrancis when we have a bit more time free we'll do some reading on this spec. Ideally we'd prefer not to have to load a polyfill with the library, but it's definitely worth us doing some reading.

@craigfrancis
Copy link
Author

Just for reference, you are kind of doing all the work of the pollyfill anyway, so you shouldn't need to include any extra JS.

Hopefully (and this is from someone who hasn't really looked in detail at your code), you will be able to change:

<div class="modaal-wrapper...

To

<dialog class="modaal-wrapper...

Then update the appropriate methods to either call the native showModal()/close() methods, or call your own.

This would help provide some semantics to the document, and help with tab focus (as browsers that support these will be able to do a much cleaner job than looking at e.keyCode == 9).

One thing that might be odd is handling the ::backdrop for styling.

:-)

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

No branches or pull requests

2 participants