EDITOR: When navigating to an internal link with a heading or block ref, move cursor and viewport to the beginning of the target location

Use case or problem

Normally when you follow a URL fragment (for example, in a web browser) the linked-to element of the page is loaded into view — usually at the top, or the bottom (awkward but at least it’s there), or maybe in the middle.

When you follow one in Obsidian — a link to a heading — the entire section under the heading is highlighted and the end of the section is loaded into view, often putting the linked-to heading off-screen. The highlight is nice, but this is surprising and inconvenient. When I follow a link to a heading, I expect to see the heading.

Proposed solution

Load the top of the section, not the bottom. Ideally (I think), place it in the middle of the screen to avoid the confusion that sometimes results when the looked-for item is at the very top or bottom edge of the screen.

Obsidian already behaves in the requested way in Reading Mode (as I learned from Highlight entire section when opening links to headings in reading/preview mode as opposed to only highlighting the heading).

Current workaround (optional)

I’m not working around it. I could link to the section before the one I want (if any), but I don’t because it’s an ugly, misleading hack.

Related feature requests (optional)

Original version of this request as a bug report:

Conceptually related Mobile bug report (I know the code bases differ):

Similar behavior as the Mobile bug, restricted to certain circumstances:

Cursor goes to one place, view to another:

This sentence is so people who write “header” instead of “heading” can find this post.

9 Likes