Newer Version Available

This content describes an older version of this product. View Latest

disableTabClose() for Lightning Experience

Prevents a workspace tab or subtab from closing. This method removes the close button from a tab or subtab, and disables the keyboard shortcuts that close tabs and subtabs. This method works only in Lightning console apps.

Arguments

Name Type Description
tabId string The ID of the workspace tab or subtab to disable tab close for.
disabled boolean Specifies whether to disable tab close.

disableTabClose() doesn’t prevent the browser from refreshing or closing the browser tab.

Note

Sample Code

This component has a button that, when pressed, disables the ability to close the currently focused tab.

Component code:

Controller code:

Response

This method returns a promise that, upon success, resolves to a tabInfo object representing the focused tab. A tabInfo object is a JSON array of information about a workspace tab, with nested arrays of information on each subtab. This is the structure of a tabInfo object.