Skip to content

fix: Fix active template highlight#819

Open
yasuharu519 wants to merge 1 commit into
obsidianmd:mainfrom
yasuharu519:fixup-active-template-highlight
Open

fix: Fix active template highlight#819
yasuharu519 wants to merge 1 commit into
obsidianmd:mainfrom
yasuharu519:fixup-active-template-highlight

Conversation

@yasuharu519
Copy link
Copy Markdown

@yasuharu519 yasuharu519 commented May 3, 2026

What's happening

Two different visible behaviors that turn out to be the same underlying issue:

  1. Selecting a template in the sidebar does not highlight that template — the active class stays on whatever item was highlighted before.
  2. After duplicating a template, the wrong (unrelated) template gets highlighted, and switching to a different one does not move the highlight.

Both come from the same problem: when a template is selected, the internal editingTemplateIndex is updated but the DOM .active class on the template list is never re-synced.

Fix

updateTemplateListActiveState(templateId) already exists in settings-section-ui.ts for exactly this purpose, but it is no longer called anywhere.
Call it from showSettingsSection whenever the templates section is shown with a templateId.
Since showTemplateEditor() always ends with showSettingsSection('templates', editingTemplate.id), this covers all selection paths (click, duplicate, new, delete-then-select-next, import, URL restore, drag-and-drop reorder).

Fixes #440

@yasuharu519 yasuharu519 changed the title Fix active template highlight fix: Fix active template highlight May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Template highlighted in left sidebar only stays on the first template

1 participant