Skip to content

feat(dialog): Alert, Prompt, Custom Component dialogs via DialogService#207

Merged
mathewtaylor merged 20 commits intodevelopfrom
feature/dialog-improvements
Mar 8, 2026
Merged

feat(dialog): Alert, Prompt, Custom Component dialogs via DialogService#207
mathewtaylor merged 20 commits intodevelopfrom
feature/dialog-improvements

Conversation

@mathewtaylor
Copy link
Copy Markdown
Contributor

@mathewtaylor mathewtaylor commented Mar 5, 2026

Summary

  • Adds DialogService.AlertAsync(), PromptAsync(), and OpenAsync<TComponent>() alongside the existing ConfirmAsync()
  • BbDialogProvider now supports escape key handling (via Primitives escape-keydown.js stack), focus trap, scroll lock, and dynamic sizing for component dialogs
  • Proper IAsyncDisposable cleanup of all JS interop references
  • Correct ARIA roles (alertdialog for Alert/Confirm, dialog for Prompt/Component)
  • DialogSize enum wired up to container classes (was dead code)
  • XML doc fixes on obsolete Confirm() and DialogOptions.ConfirmText
  • Complete demo page with View Code sections for all examples
  • Full API reference covering all sub-components, DialogService methods, option types, and IDialogReference

Based on PR #184 by @Denny09310 with review fixes applied.

Denny09310 and others added 18 commits March 4, 2026 15:26
Introduced a typed and flexible dialog infrastructure:

* Added new base classes (`DialogData`, `DialogData<TResult>`) to support asynchronous and strongly-typed dialog results.
* Implemented Alert, Prompt, and custom Component dialogs, including their respective option classes and dedicated Razor components.
* Updated `DialogService` to manage a generic dialog collection and expose new methods for alert, prompt, and custom dialogs.
* Refactored dialog resolution to a generic `Resolve<TResult>` pattern with centralized closing logic and improved backdrop handling.
* Introduced `DialogOptions`, `DialogOpenOptions`, the `DialogSize` enum, and the `DialogResult` type.
* Added a reusable `DialogHeader` component for standardized dialog headers.
* Improved overall extensibility and reusability of the dialog system.
…, and fix review issues

- BbDialogProvider: reuse Primitives escape-keydown.js stack for proper
  Escape handling (respects PreventClose, blocks AlertDialog dismiss)
- BbDialogProvider: add focus trap via IFocusManager and scroll lock via
  portal.js lockBodyScroll when dialogs are active
- BbDialogProvider: wire up DialogSize from ComponentDialogData.Options
  to dynamic container classes (was dead code in ComponentDialog)
- BbDialogProvider: implement IAsyncDisposable, properly dispose JS
  module references (portalModule, escapeModule)
- BbDialogProvider: use correct ARIA role (alertdialog for Alert/Confirm,
  dialog for Prompt/Component)
- ComponentDialog: remove dead GetWidth() method
- DialogService: fix XML docs on obsolete Confirm() method
- DialogOptions: fix ConfirmText XML doc default value ("OK" not "Continue")
- DialogDemo: add View Code sections for Form, Nested, Non-Dismissible demos
- DialogDemo: add selected-value labels to nested dropdown controls demo
- DialogDemo: add comprehensive API reference for all dialog sub-components,
  DialogService methods, option types, and IDialogReference
- Update API surface snapshot
@mathewtaylor mathewtaylor mentioned this pull request Mar 5, 2026
10 tasks
- Add aria-labelledby/aria-describedby to dialog containers for screen readers
- Fix focus trap to track topmost dialog when multiple are stacked
- Use per-dialog ElementReference dictionary instead of single shared ref
- Re-trap focus when dialog stack changes (new dialog opened/closed)
- Replace bare catch blocks with specific exception types in cleanup
- Pass Description through to ComponentDialog header
- Add parameterless OpenAsync<T>() overload for simpler component dialogs
- Add Description property to DialogOpenOptions
- Fix OpenAsync closure to capture ID directly instead of null! pattern
- Fix ConfirmDialog destructive ternary spacing
- Update MaxLength doc to match actual validation behavior
- Update API surface baseline
@mathewtaylor mathewtaylor merged commit 7833cff into develop Mar 8, 2026
@mathewtaylor mathewtaylor deleted the feature/dialog-improvements branch March 8, 2026 15:24
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.

2 participants