obsidian-hover-editor icon indicating copy to clipboard operation
obsidian-hover-editor copied to clipboard

Jump to wrong heading

Open Missionary2112 opened this issue 10 months ago • 5 comments

Issue

When I hover over a link to a heading, it pops up the note but jumps to bottom instead to the heading. However, when the heading is toggled (all content hidden), it can pop up correctly.

Expected behavior

  • Hover Editor should pop up at the right heading or block

Additional thought

When I disable Hover Editor, it pops up just the heading.

Missionary2112 avatar Aug 02 '23 18:08 Missionary2112

Please provide the notes you're using (in a format I can copy exactly) and confirm that this happens with the default theme and no other plugins active (e.g. in the sandbox or a new vault). Thanks.

pjeby avatar Aug 02 '23 19:08 pjeby

Well, I realize if the previous heading was toggled hidden, it would cause that weird jump. Otherwise, it works fine. It's okay to let all headings unfolded but sometimes I preferred to hide some. Thanks.

Test.md If you link to heading B & heading A is toggled hidden, you will see jump below heading B

Missionary2112 avatar Aug 02 '23 21:08 Missionary2112

Ah, I see what's happening. The issue is that Obsidian applies the folding after the note is loaded. The note is being opened to the correct heading by Hover Editor, but then Obsidian loads the fold state and folds the headings, so there's less text above, and it doesn't update the scroll position to compensate.

After doing a bit more investigation, it appears to be an issue with reading mode. If you click a link like that with reading mode you get the same issue, so it's not actually Hover Editor at all. It should probably be reported as an Obsidian bug -- i.e. the part where if you click on a link to a heading and there's folds above it, the text scrolls to hide where your link went.

To work around it in the meantime, you can use edit mode as your default view in Hover Editor.

pjeby avatar Aug 02 '23 22:08 pjeby

I actually have a similar problem:

When I hover over a link to an H2, hover editor will jump

  1. either to a place positioning the selected header in the middle of hover popup (editing view) or
  2. to a place way below that (reading view). I guess that is what you referred to, @pjeby

In any case, the document without hover editor works fine. I use a CSS snippet to resize it and with this workaround alone, everything works fine. Just to clarify: When experiencing the above behavior, I disabled the CSS snippet.

What I'd suggest is:

  1. Fixing hover editor to jump to the linked location with it being displayed on top inside the popup window.
  2. Initial popup should behave like normal popup, meaning show only linked passage or quote
  3. Adding a button to the window frame to expand to full note inside popup

I suspect this is a lot of work, even though I am not a programmer myself.

Thank you very much for this plugin anyway. It is a very nice addition to the Obsidian functionality and I would love to use it. But for now, I will return to CSS workaround as I find the scrolling too frustrating.

As for the file I used: I do not want to share it because it is concerned with too much of a private matter.

What I did, however, was crosschecking with other notes where this behaviur did not occur. The differences are: The erraticly behaving file makes use of

  1. Plugin SimpleTimeTracker
  2. Tables

Maybe that helps to pinpoint why the problem occurs.

feedhopper avatar Aug 19 '23 08:08 feedhopper

If you only have a "similar" issue you should open a new issue with the details. But unless you can provide reproduction steps of some kind, there is nothing that I can do to investigate the issue. (Do note that you can just replace sensitive text (or all the text) with stuff like "xxxx xx xxxxx", so long as it still demonstrates the issue.)

Regarding "fixing" hover editor, however, the issue described in this bug report is an Obsidian bug, not a bug in Hover Editor. Hover Editor is faithfully reproducing what you would get if you clicked the link, which is what Hover Editor does. It does not emulate all the features or limitations of Page Preview. Issue #70 tracks the feature request for adding "zoom in" behavior when hovering links to specific sections or headings.

pjeby avatar Aug 19 '23 09:08 pjeby