I find it a bit strange that nobody mentioned the dialog html element.
It is better than using a div and it has javascript events.
If you are feeling adventurous the CSS tricks from this post can be used. Personally I would stick to the small amount of javascript you need to add to make the dialog working.
I find it a bit strange that nobody mentioned the dialog html element.
It is better than using a div and it has javascript events.
If you are feeling adventurous the CSS tricks from this post can be used. Personally I would stick to the small amount of javascript you need to add to make the dialog working.
Zero JS code is required if you use the Popover API with dialog element.
Thank you for sharing that, I didn't know it existed. From MDN I see it is an experimental feature.
You're welcome. It's only experimental if you use hint popovers:
developer.mozilla.org/en-US/docs/W...
Haha, yes, exactly!
We personally do use these tricks internally, but most of the time, from what we see, it's a design system / component library implementation detail.