Web: 5 Modal/Dialog development problems you should know

In a perfect world, this is what you want:

In a perfect world, this is what you want.

1. Nested Positions

Having multiple conflicting nested positions. Using might fix your problem but in some older browser or some edge scenario, still works unreliably when the element is nested inside other position values.

2. Overlapping z-index

Overlapping z-indices can be an annoying problem when trying to render your modal above element with higher z-index implementation. However, you can’t just avoid using z-index entirely, some design requirement still requires you to use z-index to overlay elements above.

For my projects, I have a z-index schema that I reference.

3. Cascading Parent CSS

If you nest your Modal inside a parent element with overarching CSS rules, it might conflict with your modal CSS rules.

4. Scrolling Issues

Your body scroll when your modal is above. You tried locking the scroll bar but your modal has overflowing content.

Solution? Use this body-scroll-lock library.

5. iOS Safari 100vh

What you see when designing. What you see when testing. What the user actually sees. What you actually want.

Apple: It’s a feature, not a bug.
You: But my modal is broken.
Apple: This is completely intentional. It took quite a bit of work on our part to achieve this effect. :)
You: ???
Product Manager: Is it fixed yet?
You: ???


Use a modal library.

Also, you can check out this microsite that I created to illustrate those 5 issues.

I am a full-stack capable Web, Android, iOS, DevOps, software engineer and architecture.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store