What the guidance says

  • Present content modally only when the task or decision benefits from temporarily suspending the previous context.
  • Keep modal tasks short and avoid deep navigation inside a modal view.
  • Provide an obvious dismissal control and protect entered content from accidental loss.
  • Avoid stacking modal views or showing more than one alert at a time.

How to apply it on the web

  • Use an accessible dialog component that traps focus, labels the view, and restores focus on close.
  • Close with a visible cancel or done action and support Escape unless the task must block dismissal.
  • Use an alert dialog only when people must acknowledge or choose before continuing.
  • Keep destructive choices explicit and provide a safe cancel action.

What to check

  • Is interruption necessary for this information or task?
  • Does the dialog have an accessible title and clear dismissal path?
  • Does focus enter, stay within, and return from the dialog correctly?
  • Will dismissal lose entered data, and if so, is that consequence explained?

Official sources