TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is a modal window in UI? Rules and examples

A modal window blocks the page behind it until the user responds. How it differs from a popover or toast, when to use one, the accessibility rules and how to measure it.

Sophia Bennett Reviewed by Oliver Reed Also called modal Last updated Nov 20, 2026 Glossary

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.

PatternBlocks the page behind it?How it closesFocus moves into it?Use it for
Modal dialogYes: the rest of the page is inertButton, Esc, sometimes click outsideYes, and stays insideA decision or input that cannot be skipped: confirm a deletion, sign in to save
Nonmodal dialogNoClose buttonMoves in, but the page stays usableA task the user may want to leave open: a compose window, a help panel
PopoverNoClick outside or Esc (light dismiss)OptionalA small panel tied to a control: a menu, a date picker, a tooltip
ToastNoDisappears on its own, sometimes a close buttonNoA 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:

  1. 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.
  2. Information needed to continue. Asking a signed-out visitor to sign in when they save a favourite is an example.
  3. A short multi-step workflow such as a wizard. If it needs many steps, a full page may work better.
  4. 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:

BehaviourshowModal()show()
Rest of pageInert (cannot be interacted with)Stays interactive
Backdrop::backdrop is renderedNone
LayerTop layer, above other contentNot in the top layer
Implied ARIAaria-modal="true"aria-modal="false"
Esc keyCloses by defaultDoes 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:

  1. Keyboard. Tab and Shift+Tab cycle through the dialog's focusable elements and wrap at either end instead of leaving. Esc closes it.
  2. 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).
  3. Focus on close. Return focus to the element that opened the dialog, unless it no longer exists.
  4. Labelling. Give the container role="dialog" and name it with aria-labelledby pointing to a visible title.
  5. A visible close button in the tab order, for people who do not use a keyboard shortcut.
  6. 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.

MetricCountRate
Sessions20,000
Modal shown3,20016.0% of sessions
Closed with the close button2,24070.0% of shown
Closed with Esc or a click outside64020.0% of shown
Completed (sign-up)32010.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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

Was this explanation clear?

We use your answers to fix and expand this page.

Sophia Bennett

Product Adoption Consultant

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

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is a modal in UI?

A modal is a dialog that appears on top of the page and disables the content behind it until the user responds. The rest of the interface is inert, so the user cannot scroll or click elsewhere until they confirm, cancel or close it.

What is the difference between a modal and a popover?

A modal blocks the page behind it and takes focus; a popover is always non-modal, so the page stays usable, and it usually closes when you click outside. Use a popover for a menu or small panel tied to a control, a modal for a decision that cannot be skipped.

When should you not use a modal?

Avoid modals for nonessential requests such as newsletter sign-ups, for high-stakes flows like checkout, and for decisions where the modal covers information the user needs. Google also treats promotional overlays that obstruct content as intrusive interstitials.

How do you make a modal accessible?

Use the dialog element or follow the ARIA pattern: move focus in on open, keep Tab inside, close on Esc, return focus to the trigger, label it with a visible title and include a visible close button. Set aria-modal only when the page behind is really blocked.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics