Simplify dialog actions, support cancelation, and add close reasons.
Review Request #14684 — Created Nov. 11, 2025 and updated — Latest diff uploaded
DialogViewlacked support for handling a cancel request from the
browser, such as when the user hit the Escape key. The dialog would
close with no feedback. This was a problem for the Confirm dialog,
which never went through the cancel response flow.There's now explicit support for handling this and direct closing using
thecancelandcloseevents, along with new Cancel actions.When closing a dialog, or when receiving a cancel/close request, a Close
Reason will be set. This contains a flag indicating if the dialog was
canceled, along with optional fields for the action triggering the
closure and any state returned from the action's click handler.To support that on the action side, we needed a Cancel action type. To
avoid introducing yet type requiring a Callback variant, we're
deprecating the*_CALLBACKversions of the types. These weren't really
necessary, as they just determined whether to invoke the provided
callback=argument.We now support
CLOSEandCANCELtypes, withCALLBACKand
CALLBACK_AND_CLOSEbeing deprecated. A default ofnullis equivalent
toCALLBACK, which invokes an action but does not close the dialog.
The old types will convert to the new on load, but are not formally
deprecated for now.If the
cancelevent is triggered on the element, and there's a
Cancel action, it will be invoked directly, allowing any callback to
be run.
Tested each action type, new and old, and verified the right behavior.
Tested both in Review Board and with the new story updates.Tested that hitting Escape closed the Confirm dialog, and triggered
the Cancel dialog behavior.