KittyGiraudel / a11y-dialog

A very lightweight and flexible accessible modal dialog script.
https://a11y-dialog.netlify.app
MIT License
2.39k stars 132 forks source link

Can the Popover API be utilized in a11y-dialog? #667

Open zerdox-scalr opened 3 months ago

zerdox-scalr commented 3 months ago

Why a11y-dialog

Building interactions that rely on events. The native <dialog> element supports cancel and close events, but their behaviors aren’t reliable. The <dialog> does not support an open event at all.

https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#dismissing_popovers_automatically_via_a_timer

Maybe we can make a11y-dialog even more lightweight by adding opt-in to utilize popover api? A popover api plugin for a11y-dialog :thinking:

KittyGiraudel commented 3 months ago

Probably worth getting @hidde’s opinion on whether it‘s worth it / a good idea as he is the person I can think of who knows most about the popover API.

hidde commented 3 months ago

It seems useful to me to include it optionally:

It would make sense (to me) though, to default to non-modal dialogs when popover is added.