[BUG] BlockActionHandler is no longer being called when "confirm" dialog is added to modal button
The deno-slack versions
"deno-slack-sdk/": "https://deno.land/x/[email protected]/", "deno-slack-api/": "https://deno.land/x/[email protected]/", "deno-slack-hub/": "https://deno.land/x/[email protected]/"
Deno runtime version
deno 1.44.1 (release, x86_64-apple-darwin) v8 12.6.228.3 typescript 5.4.5
OS info
ProductName: macOS ProductVersion: 14.4.1 BuildVersion: 23E224 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64
Describe the bug
I have a button set up in one of my Modal views that I would like to add a "confirm" dialog to. I have a BlockActionHandler set up to push a new view when the button is clicked, which works when I don't include the confirm dialog. When I do include the confirm dialog, the confirmation popup does show the correct text and give the option to confirm or deny the action, but when I hit "confirm", theBlockActionHandler is never called and it doesn't seem to be sending a different payload either.
I tried this with another button on the page and ran into the same issue.
Steps to reproduce
I followed the Button element documentation which says I can optionally add a confirm object to show a confirmation dialog after a button is clicked, so I added that to one of the buttons in my modal:
const button_911: ActionsBlock = {
block_id: "button_911",
type: "actions",
elements: [
{
type: "button",
text: {
type: "plain_text",
text: "911",
},
confirm: {
title: {
type: "plain_text",
text: "Are you sure?",
},
text: {
type: "plain_text",
text: "Confirm that you would like to click the 911 button",
},
confirm: {
type: "plain_text",
text: "Confirm",
},
deny: {
type: "plain_text",
text: "Go back",
},
},
value: request_uuid,
style: "danger",
action_id: "button_911",
},
],
};
I have .addBlockActionsHandler("button_911", button_911_clicked) set up to push a new view when this button is clicked, which calls this function:
export const button_911_clicked: BlockActionHandler<
typeof HelpModal.definition
> = async ({ client, action, body }) => {
console.log("BUTTON CLICKED");
const request_uuid = get_request_uuid(action.value);
const strings = await get_strings_for_this_step("help_modal", client);
const next_view = confirm_911_view(request_uuid, strings);
// display confirm_911 view
const push_resp = await client.views.push({
interactivity_pointer: body.interactivity.interactivity_pointer,
view: next_view,
});
if (!push_resp.ok) {
console.log(
`Failed to push 'confirm 911' modal screen. error: ${push_resp.error}`,
);
}
return;
};
Adding the confirm object worked to show the confirmation dialog/popup when I click the 911 button, but nothing happens when I click "confirm". The modal stays on the same page, and the little triangle warning icon shows up next to the 911 button.
Expected result
I expected the button_911_clicked handler function to be called when I clicked the "Confirm" button in the confirmation dialog for the 911 button. When I remove the confirm object, the handler is successfully called and works as expected
Actual result
When the confirm object is added to the button, the button_911_clicked handler is not called. I have a log message on the first line of that function and it's not printing. So it doesn't seem like an issue with the logic in that function, it seems like it's not being called at all.
The confirm object seems to cause the button to no longer send a payload when it's clicked? If I remove the confirm object from the button AND remove the .addBlockActionsHandler("button_911", button_911_clicked) line, then when I click the 911 button I get this message printed to my console:
Received block action payload with action={"block_id":"button_911","action_id":"button_911","style":"danger","type":"button","text":{"type":"plain_text","text":"911","emoji":true},"value":"6fe3e5de-821c-46f4-b907-147ae6df9db2","action_ts":"1719587368.164075"} but this app has no action handler defined to handle it!
BUT when I add the confirm object (and leave the action handler commented out), I no longer get that message.
With or without the action handler, no error messages are printed to the console.
Requirements
[X] Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Hello! Any update on this?
I'm facing the exact same issue. My buttons post and edit in Modal views used to work and w/o any code change, it suddenly stopped working on both my local and the deployed version. Is there any potential fix for the issue?
I also didn't see any error logs on my end.
Having the exact same problem, thought I was going crazy doing something wrong as the documentation does not delve into details on what the output from the Confirmation dialog object should be.