Add utilities for confirmation dialogs and error dialogs.

Review Request #14651 — Created Oct. 24, 2025 and updated

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 the dialogs in all supported conditions.

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

Description From Last Updated

There's an extra period here.

maubinmaubin
maubin
  1. 
      
  2. Show all issues

    There's an extra period here.

  3. 
      
chipx86
Review request changed
Change Summary:
  • onConfirm handlers 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
    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.

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

Commits:
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. 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.
e2796cf9cd3e3f8be6ea063afb9cda556d6fec69
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

Checks run (2 succeeded)

flake8 passed.
JSHint passed.