Add utilities for confirmation dialogs and error dialogs.
Review Request #14651 — Created Oct. 24, 2025 and updated — Latest diff uploaded
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.