DEV Community

Discussion on: Create Custom PopUp Component in React

Collapse
 
link2twenty profile image
Andrew Bone

Hey, something cool you can do with your posts to help people understand is add a demo. You can use something like codesandbox to host your code and then embed it straight into your post, like this.

A couple of suggestions for you to think about that, I think, will give a better user experience;

  • Use portals so your popup isn't sitting in the dom even when it's not being used.
  • Look into some way to trap focus so keyboard users don't end up focusing outside the popup.
  • Finally it might be worth reading though the aria examples for a dialog so you can copy the expected behaviours.

All in all a solid start 👍

Collapse
 
g10dra profile image
Jeetendra

Thanks Andrew,
I will look into the suggestions