Behavior comparison
Choose Alert dialog for: Confirming a permanent deletion. Choose Lightbox for: Inspecting product photography at a larger size.
| 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 with aria-modal=true | dialog with aria-modal=true containing figure content |
| 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. |