Skip to content

openSettingTab

Opens Settings on a tab, without opening that tab a second time when it is already the active one.

Opening a tab hides the active tab and renders the new one, so opening the tab that is already shown runs its display() again for nothing, and a tab whose mount logic does not expect that can break. Settings re-opens its last tab by itself when it opens on desktop and tablet, but not on a phone, where it shows the tab list instead. So the check is on the tab that is active after Settings opened, not on the last tab id, which on a phone would leave the user on the list.

Import:

import { openSettingTab } from '@mnaoumov/obsidian-lib/settings-modal';

Signature:

function openSettingTab(params: OpenSettingTabParams): SettingTab | null

Parameters:

Parameter Type Description
params OpenSettingTabParams The parameters.

Returns: SettingTab | null — The tab now shown, or null when no tab has that id.


Links to this page: