ReferenceDialogs
media-error-dialog
An alert dialog that presents and dismisses playback errors
Import
Anatomy
Behavior
<media-error-dialog> is a specialized root driven by the player’s error feature. It uses alert semantics and reuses the backdrop, popup, title, description, and close parts from <media-dialog>; it is not nested inside <media-alert-dialog>. It opens when the attached media reports an error and stays hidden otherwise. Closing it dismisses the current error in the player store.
The title, description, and close label use localized default text. Provide children to any of those parts to replace its default content. Known media error codes use the matching translated message, while custom error messages are shown as written.
The included player skins already render an error dialog. Compose this component directly when building a custom skin.
Styling
Use data-open, data-starting-style, and data-ending-style to style visibility and transitions.
Accessibility
The popup uses role="alertdialog". Its title and description are connected with aria-labelledby and aria-describedby.
Modality is scoped to the player container rather than the page. While the error is open, the rest of the container is inert and focus that lands elsewhere inside it returns to the popup, but content outside the player stays interactive and aria-modal is omitted. Only when the popup renders outside the container does the dialog fall back to document-wide modality: aria-modal="true", Tab cycling within the popup, and everything outside it inert.
Pressing Escape or activating the close part dismisses the error.
Examples
The example replaces the video source with invalid local data so the media element reports an error without making a failing network request.