Add support for async click handlers for buttons.

Review Request #14683 — Created Nov. 10, 2025 and updated

Information

Ink
master

Reviewers

A button's onClick can now be async. If a Promise is returned, the
button will be in a busy state until the Promise is resolved. This
ensures that the button can't be clicked a second time, and means the
caller doesn't have to micro-manage this.

Handlers that do need to micro-manage the state (such as setting the
busy state for multiple buttons at once) simply don't need to be async.
The button will work as before.

The Ink stories have been updated to show off click handlers for both
cases.

Tested both async and standard onClick handlers.

Summary ID
Add support for async click handlers for buttons.
A button's `onClick` can now be async. If a Promise is returned, the button will be in a busy state until the Promise is resolved. This ensures that the button can't be clicked a second time, and means the caller doesn't have to micro-manage this. Handlers that *do* need to micro-manage the state (such as setting the busy state for multiple buttons at once) simply don't need to be async. The button will work as before. The Ink stories have been updated to show off click handlers for both cases.
f45fa42076513d092f241e9eb550a1fcbcaf8854
Description From Last Updated

I don't think we need/want the parens here.

daviddavid
chipx86
Review request changed
Change Summary:

Added a unit test.

Commits:
Summary ID
Add support for async click handlers for buttons.
A button's `onClick` can now be async. If a Promise is returned, the button will be in a busy state until the Promise is resolved. This ensures that the button can't be clicked a second time, and means the caller doesn't have to micro-manage this. Handlers that *do* need to micro-manage the state (such as setting the busy state for multiple buttons at once) simply don't need to be async. The button will work as before. The Ink stories have been updated to show off click handlers for both cases.
0f9135c0e5896a9f43536431bf788e44be158cca
Add support for async click handlers for buttons.
A button's `onClick` can now be async. If a Promise is returned, the button will be in a busy state until the Promise is resolved. This ensures that the button can't be clicked a second time, and means the caller doesn't have to micro-manage this. Handlers that *do* need to micro-manage the state (such as setting the busy state for multiple buttons at once) simply don't need to be async. The button will work as before. The Ink stories have been updated to show off click handlers for both cases.
f45fa42076513d092f241e9eb550a1fcbcaf8854

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. 
      
  2. Show all issues

    I don't think we need/want the parens here.

    1. Oh, nevermind, I see why.

  3.