Add utilities for confirmation dialogs and error dialogs.

Review Request #14709 — Created Nov. 25, 2025 and discarded

Information

Ink
master

Reviewers

This introduces two new utility functions for easily constructing and
processing common types of message dialogs:

  • Ink.showConfirmDialog: Shows a confirmation dialog (a replacement
    for window.confirm().

  • Ink.showErrorDialog: Shows an error dialog (a replacement
    for window.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 in Storybook and changes in Review Board.

Summary ID
Add utilities for confirmation dialogs and error dialogs.
This introduces two new utility functions for easily constructing and processing common types of message dialogs: * `Ink.showConfirmDialog`: Shows a confirmation dialog (a replacement for `window.confirm()`. * `Ink.showErrorDialog`: Shows an error dialog (a replacement for `window.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.
0e0003060dc1b36530bac209c88c9d508eefa12a
chipx86
Review request changed
Status:
Discarded