ThreadSky
About ThreadSky
Log In
keithamus.social
•
5 days ago
Hey friends, did you know you can make a modal
element dismissible by clicking outside (aka light dismiss) by adding `closedby=any` to it. That's it. That's all there is to it.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/closedBy
Chrome 134+, Firefox 140+, coming soon to Safari.
Comments
Log in
with your Bluesky account to leave a comment
[–]
aardrian.bsky.social
•
5 days ago
Unless you are using one of the current, modern browsers that doesn’t support it.
So that’s not all there is to it.
2
1
reply
[–]
keithamus.social
•
5 days ago
If you're not using one of the supported browsers you can try a polyfill!
https://github.com/tak-dcxi/dialog-closedby-polyfill
this one looks quite good, I haven't used it myself but looking at the code it seems well made.
5
reply
[–]
th3s4mur41.me
•
3 days ago
Nope, just learned that from @una.im in her Google IO presentation 🙏
2
reply
[–]
arielsalminen.com
•
5 days ago
Ahh, thank you! Just added this to the
elements on my website.
4
reply
Posting Rules
Be respectful to others
No spam or self-promotion
Stay on topic
Follow Bluesky's terms of service
×
Reply
Post Reply
Comments
So that’s not all there is to it.