DEV Community

Discussion on: How to create a pop-up: JavaScript Modal

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Your 'modal' isn't particularly modal at all. It is still possible to access controls on the page that are outside of it. This is a mistake made by many such 'modal' popup functions.

You should probably be using the <dialog> element which is designed for this purpose. It is also better for accessibility.

Collapse
 
tracy4code profile image
Tracy | Software Engineer

I have a sample project where I also used , I will add it. But depending on the flow, you won't be able to control access from the pop-up project I built.

Thank you for your contribution Randy.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

That is just my point - with your implementation you CAN access things outside of the modal when it is open. If it was implemented correctly, this should not be the case.

(BTW - My name's Jon 😀)

Thread Thread
 
tracy4code profile image
Tracy | Software Engineer

Alright. Thank you Jon.