Newer Version Available
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. |
Sample Code
This component has a button that, when pressed, disables the ability to close the currently focused tab.
Component code:
Controller code: