Adrian Marin
Joined
310 Experience
3 Lessons Completed
0 Questions Solved
Activity
I used this snippet to close the dialog when someone clicks the backdrop.
dialog.addEventListener('click', (event) => {
if (event.target.nodeName === 'DIALOG') {
dialog.close();
}
});
From here:
https://www.stefanjudis.com/blog/a-look-at-the-dialog-elements-super-powers/