Skip to content
SkillCodex
Menu

Behavior comparison

Alert dialog vs Lightbox

Decisive difference

Alert dialog interrupts for a decision to confirm or cancel; Lightbox enlarges a media item and lets the user browse a collection.

Choice criteria, links and sources
  • Alert dialogChoose Alert dialog if the user must decide before a consequential action.Open entry Alert dialog
  • LightboxChoose Lightbox if viewing media at a larger size is the task, with no consequential decision.Open entry Lightbox

See the nine dimensionsSee the sources

Alert dialog

Mission

Alert dialog

Open the warning, read the named consequence, cancel with the keyboard, then reopen and confirm deliberately.

Live result

The workspace is intact. No decision is being requested.

Step 1 of 3

Try

Try the component. Your live result appears just above. Move on at your own pace.

Behavior and edge case
What to observe
The warning names the workspace, explains permanent loss, and initially focuses the safer Keep it action.
Edge case
While deletion is submitting, both actions prevent duplicate activation and the dialog reports the pending state.

What this example shows

An Alert dialog is for a short consequential decision, not a general form and not a media viewer.

Which fits your need?

Alert dialog

Confirming a permanent deletion

Lightbox

Inspecting product photography at a larger size

Which component will you use here?
Difference and sources

An Alert dialog is for a short consequential decision, not a general form and not a media viewer.

Read the sources

    Parts of the specimen

    Select a numbered marker on the schematic, or use the list below, to see its role. The schematic shows the concept's representative state.

    Backdrop

    The layer that separates a modal surface from inactive page content.

    Decision

    Family question

    Is the task about acting, confirming a consequential decision, or viewing media?

    Three criteria to choose

    Use case

    Alert dialog

    Confirming a permanent deletion

    Lightbox

    Inspecting product photography at a larger size

    Focus

    Alert dialog

    Initial focus lands on the least destructive useful action unless reading long consequences first is safer.

    Lightbox

    Opening moves focus to the viewer or close control, contains it, and closing returns it to the originating thumbnail.

    Dismissal

    Alert dialog

    Only an explicit decision or a documented safe cancellation closes the alert; no timer or accidental outside press dismisses it.

    Lightbox

    The named close control and Escape always dismiss; outside press is optional and never the only path.

    Nine dimensions

    Trigger

    Alert dialog

    A consequential action reaches the point where explicit confirmation is required.

    Lightbox

    Selecting a thumbnail or media preview opens focused viewing.

    Modality

    Alert dialog

    Strictly modal; no background interaction is available before a decision.

    Lightbox

    Modal media viewer; the underlying page is temporarily inactive.

    Placement

    Alert dialog

    A compact, prominent viewport surface close to the current decision context.

    Lightbox

    Media is centered or fitted within a viewport overlay with nearby controls.

    Interactivity

    Alert dialog

    Offers explicit confirm and cancel decisions; it does not vanish on a timer or casual outside press.

    Lightbox

    May provide previous, next, zoom, caption, and close controls around the media.

    Focus

    Alert dialog

    Initial focus lands on the least destructive useful action unless reading long consequences first is safer.

    Lightbox

    Opening moves focus to the viewer or close control, contains it, and closing returns it to the originating thumbnail.

    Dismissal

    Alert dialog

    Only an explicit decision or a documented safe cancellation closes the alert; no timer or accidental outside press dismisses it.

    Lightbox

    The named close control and Escape always dismiss; outside press is optional and never the only path.

    Accessible role

    Alert dialog

    alertdialog[aria-modal=true]

    Lightbox

    dialog[aria-modal=true]

    Use case

    Alert dialog

    Confirming a permanent deletion

    Lightbox

    Inspecting product photography at a larger size

    Mobile behavior

    Alert dialog

    Keep the consequence readable and separate destructive and safe actions into large targets.

    Lightbox

    Fit media to the safe viewport and pair optional gestures with named, tappable controls.