Behavior comparison
Alert dialog interrupts for a decision to confirm or cancel; Lightbox enlarges a media item and lets the user browse a collection.
Decision
Is the task about acting, confirming a consequential decision, or viewing media?
| Dimension | Alert dialogAlert dialog | LightboxLightbox |
|---|---|---|
| Trigger | A consequential action reaches the point where explicit confirmation is required. | Selecting a thumbnail or media preview opens focused viewing. |
| Modality | Strictly modal; no background interaction is available before a decision. | Modal media viewer; the underlying page is temporarily inactive. |
| Placement | A compact, prominent viewport surface close to the current decision context. | Media is centered or fitted within a viewport overlay with nearby controls. |
| Interactivity | Offers explicit confirm and cancel decisions; it does not vanish on a timer or casual outside press. | May provide previous, next, zoom, caption, and close controls around the media. |
| Focus | Initial focus lands on the least destructive useful action unless reading long consequences first is safer. | Opening moves focus to the viewer or close control, contains it, and closing returns it to the originating thumbnail. |
| Dismissal | Only an explicit decision or a documented safe cancellation closes the alert; no timer or accidental outside press dismisses it. | The named close control and Escape always dismiss; outside press is optional and never the only path. |
| Accessible role | alertdialog[aria-modal=true] | dialog[aria-modal=true] |
| Use case | Confirming a permanent deletion | Inspecting product photography at a larger size |
| Mobile behavior | Keep the consequence readable and separate destructive and safe actions into large targets. | Fit media to the safe viewport and pair optional gestures with named, tappable controls. |
Audience measurement
With your consent, Google Analytics and aggregate first-party counters measure site usage to help us improve it. These counters contain no search text, candidate, session identifier, or event identifier. You can change your choice anytime via “Cookies” in the footer.