Add utilities for confirmation dialogs and error dialogs.
Review Request #14651 — Created Oct. 24, 2025 and updated
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 |
|---|---|
| 0e0003060dc1b36530bac209c88c9d508eefa12a |
| Description | From | Last Updated |
|---|---|---|
|
There's an extra period here. |
|
- 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