[Bug] Calling revealLeaf while focusing on a popout window

Steps to reproduce

  1. Open the sandbox vault and create three notes: A.md, B.md, and C.md.

  2. In the primary window, open A.md and B.md in adjacent tabs in the same tab group, and open C.md in a popout (secondary) window.

  3. Focus on the tab opening B.md in the primary window, and then focus on C.md in the popout window. Now the entire workspace should look like this:

  4. Now, try to reveal the tab opening A.md with the following code:

const leafA = app.workspace.getLeavesOfType('markdown').find((leaf) => leaf.view.file.name === 'A.md');
app.workspace.revealLeaf(leafA);

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

  • The focus should move to the primary window.
  • In the primary window, the tab with A.md should be revealed. (This is how it works if I run the same code while focusing on the primary window)

Actual result

  • The focus correctly moves to the primary window (which is great),
  • however, the primary window keeps showing the tab with B.md.

Screen Recording 2024-04-28 at 21.29.13

Environment

SYSTEM INFO:
Obsidian version: v1.5.12
Installer version: v1.5.12
Operating system: Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:41 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T8103 22.6.0
Login status: logged in
Catalyst license: none
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

None