Will Ginsberg | freelance web developer

Modals can just be awkward

September 30, 2026

Some modals are really bad. 1

But even the good ones can be awkward.

1 - Sorry, I can't send you a link to that

Suppose we are implementing a page with a list of products, and clicking on a product opens a modal which shows product details. How can the user share a link to those product details with someone else? Since it's not a page it doesn't have a URL of its own and there is no link to share.

Opening a product detail modal with no URL update.

2 - How do I re-open that?

We can solve 1 by updating the URL with something like this: /products?productId=xyz

Now consider what happens if I open the link, proceed to close the modal, and then want to open it again.

It's possible that the product was not actually displayed in the product list, and I have no way to open it again.

Closing a product detail modal with no way to re-open it.

3 - Browser history to the rescue?

If our updated URL adds entries to the browser history, then 2 can be solved by just hitting the browser "back" button. Of course, not everyone will realize that they can hit "back" and get back to the modal. Even if they do, do we even want this?

I'd argue not really. Having modals open and close in response to the back/forward buttons in the browser is often going to just be unexpected.

It's awkward.

Opening and closing product detail modals with the browser "back" and "forward" buttons.

Use pages instead

Pages do not have any of the problems listed above. Pages have URLS. They can be re-opened with links. Users understand that they can re-visit pages by moving forward and backward through their browser history. 2

Modal rules of thumb

Here's where I think modals are ok to use:


  1. Really bad modals
    • Fail to lock scrolling on the page behind the modal
    • Fail to trap keyboard focus in the modal
    • Are missing attributes like role="dialog" and aria-labelledby which is not ideal for screen readers
    If you use a component library like Mantine these things are handled out of the box.
  2. I hope anyway. If they don't, you may have bigger problems.