Skip to content

feat(html): add alert dialog element#741

Merged
mihar-22 merged 2 commits intomainfrom
feat/alert-dialog-html
Mar 5, 2026
Merged

feat(html): add alert dialog element#741
mihar-22 merged 2 commits intomainfrom
feat/alert-dialog-html

Conversation

@mihar-22
Copy link
Copy Markdown
Member

@mihar-22 mihar-22 commented Mar 5, 2026

Summary

Add AlertDialogElement (<media-alert-dialog>) custom element for the HTML player — the base component that ErrorDialogElement will extend.

Changes

  • AlertDialogElement extends MediaElement with open property and data-open attribute via applyStateDataAttrs
  • Focus management: captures previous focus on open, restores on close
  • Dismiss via Escape key (with stopPropagation) or any child <button> click, dispatches close event
  • Cleanup via AbortController in connectedCallback / disconnectedCallback
  • Registration file with safeDefine and HTMLElementTagNameMap declaration
  • Exported from package barrel (packages/html/src/index.ts)
Implementation details

No core class needed — the state is just { open: boolean }, too thin to justify a separate core layer. The element uses listen() from @videojs/utils/dom for event binding, tied to an AbortController for automatic cleanup on disconnect.

Testing

14 tests covering: tag name, default state, data-open attribute toggling, Escape key handling, button click dismiss, focus management, event propagation, and listener cleanup on disconnect.

pnpm -F @videojs/html test src/ui/alert-dialog

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 5, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit f8540bc
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69aa15068267160008669435
😎 Deploy Preview https://deploy-preview-741--vjs10-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 5, 2026

📦 Bundle Size Report

Package Size Diff %
@videojs/core 11.96 kB 0 B ░░░░░░░░ 0%
@videojs/element 1.60 kB 0 B ░░░░░░░░ 0%
@videojs/html 29.27 kB +231 B ████████ +0.8% 🔺
@videojs/icons 7.49 kB 0 B ░░░░░░░░ 0%
@videojs/react 17.47 kB +26 B █░░░░░░░ +0.1% 🔺
@videojs/store 1.97 kB 0 B ░░░░░░░░ 0%
@videojs/utils 2.97 kB 0 B ░░░░░░░░ 0%

Total: 72.72 kB · +257 B · +0.3%


Entry Breakdown

Subpath sizes are the additional bytes on top of the root entry point, measured by bundling root + subpath together and subtracting the root-only size.

@videojs/core
Entry Base PR Diff %
. 4.82 kB 4.82 kB 0 B 0%
./dom 7.13 kB 7.13 kB 0 B 0%
total 11.96 kB 11.96 kB 0 B 0%
@videojs/element
Entry Base PR Diff %
. 817 B 817 B 0 B 0%
./context 823 B 823 B 0 B 0%
total 1.60 kB 1.60 kB 0 B 0%
@videojs/html
Entry Base PR Diff %
. 17.23 kB 17.65 kB +434 B +2.5% 🔺
./video 9.48 kB 9.37 kB -111 B -1.1% 🔽
./audio 1.21 kB 1.16 kB -54 B -4.4% 🔽
./background 1.13 kB 1.09 kB -38 B -3.3% 🔽
total 29.04 kB 29.27 kB +231 B +0.8%
@videojs/icons
Entry Base PR Diff %
./react 2.27 kB 2.27 kB 0 B 0%
./html 1.52 kB 1.52 kB 0 B 0%
./render 1.59 kB 1.59 kB 0 B 0%
./element 2.11 kB 2.11 kB 0 B 0%
total 7.49 kB 7.49 kB 0 B 0%
@videojs/store
Entry Base PR Diff %
. 1.32 kB 1.32 kB 0 B 0%
./html 465 B 465 B 0 B 0%
./react 196 B 196 B 0 B 0%
total 1.97 kB 1.97 kB 0 B 0%
@videojs/utils
Entry Base PR Diff %
./array 104 B 104 B 0 B 0%
./dom 1.07 kB 1.07 kB 0 B 0%
./events 227 B 227 B 0 B 0%
./function 261 B 261 B 0 B 0%
./object 119 B 119 B 0 B 0%
./predicate 265 B 265 B 0 B 0%
./string 148 B 148 B 0 B 0%
./style 185 B 185 B 0 B 0%
./time 478 B 478 B 0 B 0%
./number 158 B 158 B 0 B 0%
total 2.97 kB 2.97 kB 0 B 0%

ℹ️ How to interpret

Sizes are minified + brotli, measured with esbuild.
Package totals are computed as root size + marginal subpath costs.
Subpath marginal cost = (root + subpath bundled together) − root alone.

Icon Meaning
No change
🔺 Increased ≤ 10%
🔴 Increased > 10%
🔽 Decreased
🆕 New (no baseline)

Run pnpm size locally to check current sizes.

@mihar-22 mihar-22 force-pushed the feat/alert-dialog-html branch from 9d25455 to b194d32 Compare March 5, 2026 23:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 5, 2026

CI Failure Diagnosis

File Type What failed
.github/workflows/ci.yml build GitHub Actions infrastructure error: "Failed to resolve action download info" (Service Unavailable) — not a code issue. Re-run the workflow.

@mihar-22 mihar-22 force-pushed the feat/alert-dialog-html branch 2 times, most recently from cf791d6 to 4e11e33 Compare March 5, 2026 23:32
@mihar-22 mihar-22 force-pushed the feat/alert-dialog-html branch from 4e11e33 to f8540bc Compare March 5, 2026 23:42
@mihar-22 mihar-22 marked this pull request as ready for review March 5, 2026 23:46
@mihar-22 mihar-22 merged commit 5fc52aa into main Mar 5, 2026
19 checks passed
@mihar-22 mihar-22 deleted the feat/alert-dialog-html branch March 5, 2026 23:46
This was referenced Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant