0

We are using an LWC as a quick action.

I believe that since the screen type is ScreenAction, Salesforce is creating a new modal window (inclusive of an X icon), and rendering our component's markup inside it.

The component displays a lighting-datatable of records, and if the user selects some records from that table and happens to click on the Cancel button (this is a custom lightning-button named Cancel in the modal footer), we have to show a lighting-confirm asking weather the user is sure to close the modal as he has unsaved changes. If he answers yes, we programatically close the modal by firing the CloseActionScreenEvent().

The problem is that when the user clicks on the 'X' icon on the top-right of the modal, the modal closes automatically and the lightning-confirm does not show

How can we detect the clicking of the 'X' icon on the top-right?

1 Answer 1

1

You can't detect nor prevent the standard quick action modal's close button from being utilized. Instead, you'll want to consider using a lightning-modal, and then Enable the Component as a Screen Action as described in lightning-quick-action-panel. You can then use the disable-close property to prevent closing the modal under normal circumstances. However, this is an on/off feature, meaning the user will have to click cancel to close the modal. You can turn the attribute on/off based on if any selections have been made.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .