Context menu on link does not correctly position cursor in live preview on task switch

Steps to reproduce

  1. In a new note (live preview), create a heading and a list below it. Make one of the list items an external link
  2. Position the cursor at the end of the heading line
  3. Switch to another application or Obsidian window, while leaving the note on the screen (as you’ll need to click it in the next step)
  4. Right click the external link

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

Y

Expected result

The cursor should be placed on the line with the link, and the context menu should not contain heading-specific menu items

Actual result

Cursor is on the heading and heading actions are shown in the menu, along with actions for the link

Environment

SYSTEM INFO:
Obsidian version: v1.4.3
Installer version: v1.3.5
Operating system: Windows 10 Pro 10.0.19045
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: light
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

The problem does not occur in source mode, so it might be something to do with reformatting for the change in focus.

It doesn’t only do this with headings, and I’m not sure if an external link is really necessary, but it is a solid repro if the right click is on one. I originally discovered this because I was right clicking external links in a list and sometimes my menu choices were applying to the wrong link – it took a while to figure out that the cursor was going back to its last position instead of to the clicked position – but only when the window was inactive before the click. (It’s a lot easier to see that the menu is messed up when it’s showing both heading and link items, though.)