Skip to content

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

Open
mathewtaylor wants to merge 18 commits intodevelopfrom
feature/dialog-improvements
Open

feat(dialog): Alert, Prompt, Custom Component dialogs via DialogService#207
mathewtaylor wants to merge 18 commits intodevelopfrom
feature/dialog-improvements

Conversation

@mathewtaylor
Copy link
Contributor

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.

Test plan

  • Alert dialog: opens, blocks Escape/backdrop close, closes on OK
  • Confirm dialog: opens, Escape/backdrop resolves as Cancelled, Continue resolves as Confirmed
  • Prompt dialog: Required/MaxLength validation disables submit, Escape cancels, submit returns value
  • Custom component dialog: DialogSize variants render correct widths, PreventClose blocks Escape/backdrop
  • Focus trap: Tab cycles within dialog only
  • Scroll lock: background scroll locked while dialog is open
  • Multiple dialogs: Escape closes only topmost
  • All demo sections have working View Code expandable
  • API reference renders correctly for all entries

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
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