Quick answer
A modal window is a dialog that appears over the page and blocks the content behind it until the user responds, putting the interface into a special mode. Use it for decisions that cannot be skipped, not for nonessential requests such as newsletter prompts.
What is a modal window in UI?
A modal window (also called a modal dialog or modal) is a user interface element, a box that appears on top of the page and blocks the content behind it until the user responds. While it is open the rest of the interface is disabled, so the user cannot scroll, click or type anywhere else. Nielsen Norman Group defines it as a dialog that puts the system into a special mode, and contrasts it with a nonmodal dialog, which leaves the main content active.
The defining feature is not the overlay or the dimmed background. It is the mode: the user must deal with the modal before going on. That is why modals are powerful for decisions that cannot be skipped and irritating for everything else.
How does a modal differ from a nonmodal dialog and a popover or toast?
These four patterns are often confused. The table separates them by the one question that matters, whether the page behind stays usable.
| Pattern | Blocks the page behind it? | How it closes | Focus moves into it? | Use it for |
|---|---|---|---|---|
| Modal dialog | Yes: the rest of the page is inert | Button, Esc, sometimes click outside | Yes, and stays inside | A decision or input that cannot be skipped: confirm a deletion, sign in to save |
| Nonmodal dialog | No | Close button | Moves in, but the page stays usable | A task the user may want to leave open: a compose window, a help panel |
| Popover | No | Click outside or Esc (light dismiss) | Optional | A small panel tied to a control: a menu, a date picker, a tooltip |
| Toast | No | Disappears on its own, sometimes a close button | No | A short status after an action: "Saved", "Item added" |
In the browser these map to different features. The HTML <dialog> element opened with showModal() makes the rest of the page inert, draws a ::backdrop and places the dialog in the top layer; opened with show() it stays nonmodal. The Popover API is always nonmodal, and MDN says that <dialog> is the right choice when you need a modal one. A toast is not a separate element: it is a status message (the "Saved" confirmation is a classic microinteraction), and the accessibility guidance for it is the role="status" live region described in WCAG success criterion 4.1.3.
When is a modal the right choice?
Nielsen Norman Group lists four situations where interrupting the user is worth it:
- A critical warning that prevents or corrects an irreversible error or data loss, such as closing an unsaved document. If the error can be fixed in place, like a form error, show it on the page instead.
- Information needed to continue. Asking a signed-out visitor to sign in when they save a favourite is an example.
- A short multi-step workflow such as a wizard. If it needs many steps, a full page may work better.
- Information that saves effort later, such as asking a question once that avoids repeated contact.
A quick rule: use a modal only if you can finish the sentence "The user cannot sensibly continue until they…". If you cannot, use a nonmodal pattern.
When should you not use a modal?
The same source lists the cases that cost you trust:
- Nonessential or unrelated requests, such as newsletter sign-ups or "invite your friends" prompts, which interrupt without helping the current task.
- High-stakes flows like checkout, where an interruption distracts or pressures the user.
- Complex decisions where the user needs information that the modal covers, for example a seat map hidden behind an upsell.
Device changes the answer. NN/g describes a nonmodal sign-up prompt on desktop that turned into a full-screen modal on mobile; check each breakpoint separately, because a small box that is polite on a desktop can cover the whole screen on a phone.
Can modals hurt search visibility?
Intrusive ones can. Google's guidance on avoiding intrusive interstitials treats promotional overlays that obstruct content as a problem, including overlays that cover the whole page, a redirect to a separate page for consent or input, and app install prompts that interrupt access to content. Acceptable are banners that take up only a small fraction of the screen, browser-supported app banners, small containers for notices such as a newsletter sign-up, and interstitials required by law, such as an age gate. The rule of thumb: a visitor arriving from search should reach the content they came for without dismissing anything first.
What does the HTML dialog element do for you?
Building a modal from <div> elements means re-implementing behaviour that <dialog> provides. According to MDN, showModal() does the following and show() does not:
| Behaviour | showModal() | show() |
|---|---|---|
| Rest of page | Inert (cannot be interacted with) | Stays interactive |
| Backdrop | ::backdrop is rendered | None |
| Layer | Top layer, above other content | Not in the top layer |
| Implied ARIA | aria-modal="true" | aria-modal="false" |
| Esc key | Closes by default | Does not close by default |
<dialog> is rated Baseline "widely available" and has worked across browsers since March 2022. MDN's advice for a custom-built dialog is blunt: you must reimplement Esc handling, inerting, focus management and labelling yourself.
What must a modal do to be accessible?
The W3C's ARIA Authoring Practices for the modal dialog pattern give the baseline:
- Keyboard. Tab and Shift+Tab cycle through the dialog's focusable elements and wrap at either end instead of leaving. Esc closes it.
- Focus on open. Move focus into the dialog. The first focusable element is the default; for a long text, focus a static element at the start so it does not scroll away. For an irreversible action such as delete, focus the least destructive button (Cancel).
- Focus on close. Return focus to the element that opened the dialog, unless it no longer exists.
- Labelling. Give the container
role="dialog"and name it witharia-labelledbypointing to a visible title. - A visible close button in the tab order, for people who do not use a keyboard shortcut.
aria-modal="true"only when it is true. Use it only when your code really blocks interaction with everything behind and the styling obscures it, otherwise assistive technology users may lose access to content that is still reachable.
How do you measure whether a modal works?
Count four things: how often it is shown, how it is closed, how often it is completed, and what happens afterwards. Sample data: an exit-intent newsletter modal on a site with 20,000 sessions in two weeks.
| Metric | Count | Rate |
|---|---|---|
| Sessions | 20,000 | |
| Modal shown | 3,200 | 16.0% of sessions |
| Closed with the close button | 2,240 | 70.0% of shown |
| Closed with Esc or a click outside | 640 | 20.0% of shown |
| Completed (sign-up) | 320 | 10.0% of shown, 1.6% of sessions |
The three outcomes add up to 3,200, which is a useful check that every shown modal was counted once. The headline "1.6% of sessions signed up" looks good; "70% pressed the close button" tells you most of the people who saw it did not want it.
Be careful with the next comparison. In the same data, the 3,200 sessions that saw the modal purchased at 3.0% (96 purchases), while the 16,800 that did not purchased at 3.5% (588). That does not show the modal reduces purchases, because an exit-intent modal is shown to people who were already leaving. To measure the effect you need a holdout: hide the modal from a random share of eligible visitors and compare the groups.
How big must the holdout be? To detect a fall from 3.4% to 2.4% purchases with 80% power at the 5% level, the standard two-proportion sample-size formula gives about 4,400 sessions per group. With only 320 held-out sessions, as if you hid it from 10% of the 3,200, a one-point gap would look like noise.
How does this apply in TapCub?
TapCub does not build modals or pop-ups and does not split traffic into experiments; it measures what your modal does. Take the exit-intent example above.
- Send an event for each stage from your modal code: when it is shown, when it is closed and how, and when it is completed. See track custom events.
- Build the funnel. In All-platform analytics › Behavior › Behavior analysis, make a funnel from the shown event to the completed event. It reports step counts, the rate against the first step and the drop-off, and each step can carry its own filters. See build a funnel.
- Do the holdout in your own code, hide the modal for a random share and send that flag as a property on your events, then build the funnel twice with a step filter on the flag and compare the two groups' downstream goal.
- For chat invites, the rule list in Live chat › Chat settings › Proactive invites records impressions, open rate and reply rate for each rule. An invite fires after the visitor stays on a matching page for 3 to 600 seconds, is shown once per visitor by default, and does not create a conversation until the visitor replies.
- Check the conversion effect with care. Live chat › Reports › Conversion attribution compares goal conversion for visitors who chatted with those who did not. It is a comparison of two self-selected groups, the same selection issue as the exit-intent comparison above, and it warns when fewer than 30 visitors chatted.
See also: Overlay Popup Best Practices: Types and Google Rules.
Sources
- Nielsen Norman Group, Modal & Nonmodal Dialogs: When (& When Not) to Use Them, April 2017.
- MDN Web Docs, The Dialog element and Popover API.
- W3C WAI, Dialog (Modal) Pattern and Understanding Success Criterion 4.1.3: Status Messages.
- Google Search Central, Avoid intrusive interstitials and dialogs.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Product Adoption Consultant
Explores customer onboarding, live conversations, and self-service, turning common usage questions into practical guidance and improvements.