Obsidian doesn't scroll to the file on Reveal file in navigation

Prerequisites

“How to” folder should be collapsed on navigation pane on startup.

Steps to reproduce

  1. Open Help vault (it should be a fresh start).
    • Obsidian started with “Start Here” page opened.
    • “How to” folder is collapsed in navigation pane.
  2. Navigate to “Working with tags” page via Quick switcher.
    • Obsidian opened the page.
  3. Click “Reveal file in navigation” in the page’s menu.

Expected result

Obsidian expands “How to” folder on navigation pane, scrolls to the filename and highlight it.

Actual result

Obsidian expands “How to” folder but doesn’t scroll to the filename position. Filename is not visible on nav pane.

Environment

  • Operating system: Windows 11
  • Obsidian version: 0.12.19

Additional information

If you click “Reveal file navigation” twise or if you open the file via navigation pane and then collapse the folder, Obsidian will work as expected.

Bug reproduction screencast: 2021-11-11-Obsidian-bug-reveal-in-nav.zip (1.3 MB)

I can reproduce this on MacOS as well.

The problem seems to be if the window is too small after the folder is expanded, it won’t scroll down to the file on the first try.

If the main app window is big enough, this doesn’t occur.

Curiously, this only seems to happen on the first try. After it has occurred, I can’t seem to make it happen again. No amount of collapsing folders, navigating, etc will make it happen a 2nd time, for me, until I reopen the Help Vault.

(Also, it happens whether clicking on the UI buttons, or invoking the commands through the command palette.)