Add utilities for confirmation dialogs and error dialogs.
Review Request #14651 — Created Oct. 24, 2025 and submitted
This introduces two new utility functions for easily constructing and
processing common types of message dialogs:
-
Ink.showConfirmDialog: Shows a confirmation dialog (a replacement
forwindow.confirm(). -
Ink.showErrorDialog: Shows an error dialog (a replacement
forwindow.alert().
These are designed as utility functions that take a minimal set of
options (but can be fairly customized). They return a Promise, which is
resolved only once a choice has been made, allowing an async function to
await on the result and process it before continuing.
If the user confirmed, they'll get a truthy object that contains further
information that may be useful for processing. If they cancel, they'll
get a null result instead.
The confirmation dialog can also take an async onConfirm handler,
which will keep the dialog open and the buttons in a busy state until
completed. That may return false, which will abort the dialog the same
way as if the user hit Cancel. This is intended for error reporting
during an operation.
Confirmation dialogs can also be suppressed, using the new functionality
in DialogView. This is off by default, but can be opted into. It's up
to the caller to handle all confirmation logic.
Tested the dialogs in all supported conditions.
| Summary | ID |
|---|---|
| 90b81552313febe82ba07a92a18cddbc62c2ec1c |
| Description | From | Last Updated |
|---|---|---|
|
Do we want some kind of error icon? I feel like that can help trigger people to actually read the … |
|
|
|
There's an extra period here. |
|
|
|
The annotation here has ShowConfirmDialogResult as a parameter name. This should be: onConfirm?: ((result: ShowConfirmDialogResult) => Promise<boolean | void>); |
|
|
|
The docs for this parameter in ShowConfirmDialogOptions say the default is "Confirm" Also, do we want to extract this out … |
|
|
|
Do we want to extract this out into a constant somewhere and/or localize it somehow? |
|
|
|
The documentation in ShowErrorDialogOptions says the default for the title is "Error". Also, do we want to extract this out … |
|
|
|
This is calling done(null) but the promise is a Promise<void>. This should probably be changed to done() |
|
|
|
Do we want to extract this out into a constant somewhere and/or localize it somehow? |
|
|
|
Can we have this check if rawBody is iterable and have a separate else clause that logs an error? |
|
|
|
According to the type of MessageDialogBody this shouldn't be reachable, so this should probably be an error case. |
|
|
|
if rawBody is falsy, body is never initialized and we end up returning undefined |
|
- Change Summary:
-
onConfirmhandlers can now force a cancellation result, useful when an operation fails and an error will be shown.- Fixed a typo in a version in a doc comment.
- Description:
-
This introduces two new utility functions for easily constructing and
processing common types of message dialogs: -
Ink.showConfirmDialog: Shows a confirmation dialog (a replacement
forwindow.confirm().
-
Ink.showErrorDialog: Shows an error dialog (a replacement
forwindow.alert().
These are designed as utility functions that take a minimal set of
options (but can be fairly customized). They return a Promise, which is resolved only once a choice has been made, allowing an async function to await on the result and process it before continuing. If the user confirmed, they'll get a truthy object that contains further
information that may be useful for processing. If they cancel, they'll get a nullresult instead.The confirmation dialog can also take an async
onConfirmhandler,which will keep the dialog open and the buttons in a busy state until ~ completed. ~ completed. That may return false, which will abort the dialog the same+ way as if the user hit Cancel. This is intended for error reporting + during an operation. Confirmation dialogs can also be suppressed, using the new functionality
in DialogView. This is off by default, but can be opted into. It's upto the caller to handle all confirmation logic. -
- Commits:
-
Summary ID e2796cf9cd3e3f8be6ea063afb9cda556d6fec69 0e0003060dc1b36530bac209c88c9d508eefa12a
Checks run (2 succeeded)
-
-
Do we want some kind of error icon? I feel like that can help trigger people to actually read the text.
-
The annotation here has
ShowConfirmDialogResultas a parameter name.This should be:
onConfirm?: ((result: ShowConfirmDialogResult) => Promise<boolean | void>); -
The docs for this parameter in
ShowConfirmDialogOptionssay the default is "Confirm"Also, do we want to extract this out into a constant somewhere and/or localize it somehow?
-
-
The documentation in
ShowErrorDialogOptionssays the default for the title is "Error".Also, do we want to extract this out into a constant somewhere and/or localize it somehow?
-
This is calling
done(null)but the promise is aPromise<void>. This should probably be changed todone() -
-
-
According to the type of
MessageDialogBodythis shouldn't be reachable, so this should probably be an error case. -
- Change Summary:
-
- Fixed some outdated docs.
- Removed message body codepaths that should no longer be reachable.
- Updated for the
isSuppressChecked()change. - Removed an unnecessary value to the error dialog's
donehandler. - Fixed some types and results.
- Commits:
-
Summary ID 0e0003060dc1b36530bac209c88c9d508eefa12a 90b81552313febe82ba07a92a18cddbc62c2ec1c
