How to programmatically close a dialog in a Jira Forge "jira:issueAction" addon type

Hello,
I am developing a “jira:issueAction” type addon within Jira Forge. The custom part of the dialog contains a form with submit and cancel buttons. How can I programmatically close a dialog after pressing buttons? Is there any working example?
Thanks.
Petr

view.close()

Thanks for reply. Is this working for dialog made with newest UI Kit components?
Is there any simple working example?

import { Button } from "@forge/react";
import { view } from '@forge/bridge';

const A = () => {
 const closeModal = () => view.close()
 
 return <Button onclick={closeModal}>close</Button>
}

Thanks for the example. I have tried this in jira:issueAction module, but without success. :disappointed_relieved:
jira:issueAction module automatically creates dialog window and and maybe that’s why it doesn’t work?

should work, maybe you call the close method in the wrong context. It should be called in the opened dialog context

This is my code:

Replace onClick={view.close()} with onClick={() => view.close()}

Unfortunately that doesn’t work either. My manifest.yml is the following:

There is also following error in browser developer console:
Uncaught Error: this resource’s view is not closable.

I do not know why it is not working as expected. Try to ask @atlassian support.
Also, try to replace native UI with custom.

Thanks for trying to help. :+1:

Is there any idea how to close “jira:issueAction” dialog ?

@Andrew_Golokha @GabrielDias @vpetrychuk Could you check. Is it expected behavior for the native UI?

I asked you because you were leading (Can't close modal, fails with error message "this resource's view is not closable." - #9 by vpetrychuk)

Can confirm closing UI kit app doesn’t work. We will work on the fix next week.
Thanks,
Vitalii

2 Likes

@vpetrychuk hey, was it fixed? Thanks

Hi @Alexandr, yes it is fixed.

Just tested it, warks perfectly. Thanks!

1 Like

Thanks everyone for the help. It’s working now.

Hello,

I have a similar problem with the jiraServiceManagement:portalUserMenuAction module. The default modal window cannot be closed programmatically. Would it be possible to take a look at this, should I possibly enter a bug?

Thank you in advance.
Kristian