Page scrolls down when entering edit mode on a large table with live preview enabled

Steps to reproduce

  • Create a table longer than the height of the window
    • To test this, I just made a 2-column, ~150-row table, and padded the space below the table with some text; I’ll paste it below
    • The table has 4 groups of 38 lines - this is how many lines one press of PgDn is on my system; I initially thought it might be related but that turned out not to be the case AFAICT
  • With your cursor outside of the table so that it is showing in Live Preview, scroll to somewhere in the middle of the table, then click on a cell to activate Edit mode

Expected result

  • Ideally, I enter Edit mode with my cursor located in the table cell I clicked on and that cell still in view.
  • Fallback, if selecting the whole table and moving the cursor to the start is unavoidable, at least please keep the cell I clicked on in view so that I can click on it again to move the cursor and begin editing.
    • The downside here is that if I use keyboard cursor navigation, my view will jump to the top of the table, where the cursor currently is.

Actual result

  • The entire table is selected
  • The cursor is moved to just in front of the start of the table
  • The window scrolls down
    • This is the main problem - it’s very disorienting when editing a large table, because the cell you meant to work on may be scrolled out of view, and it can be difficult to find again while in the messier-looking Edit mode
    • The further down you were scrolled on the table to start, the more pronounced the jump when entering Edit mode:
      • If I have the 1 One cell (from my example table, below) at the top of my screen, it doesn’t scroll noticeably when entering edit mode
      • If I have 10 One at the top of my screen, it scrolls about 3 lines down (13 One is at the top of the screen in Edit mode)
      • If I have 1 Two at the top and click into Edit, it moves 16 Two to the top of the screen
      • 1 Three jumps all the way to 34 Four

Environment

  • Operating system: Windows 10
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v0.15.7
    Installer version: v0.15.6
    Operating system: Windows 10 Pro 10.0.19044
    Login status: logged in
    Catalyst license: supporter
    Insider build toggle: on
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: on

RECOMMENDATIONS:
none


Additional information

My Big Table

Row Page
1 One
2 One
3 One
4 One
5 One
6 One
7 One
8 One
9 One
10 One
11 One
12 One
13 One
14 One
15 One
16 One
17 One
18 One
19 One
20 One
21 One
22 One
23 One
24 One
25 One
26 One
27 One
28 One
29 One
30 One
31 One
32 One
33 One
34 One
35 One
36 One
37 One
38 One
1 Two
2 Two
3 Two
4 Two
5 Two
6 Two
7 Two
8 Two
9 Two
10 Two
11 Two
12 Two
13 Two
14 Two
15 Two
16 Two
17 Two
18 Two
19 Two
20 Two
21 Two
22 Two
23 Two
24 Two
25 Two
26 Two
27 Two
28 Two
29 Two
30 Two
31 Two
32 Two
33 Two
34 Two
35 Two
36 Two
37 Two
38 Two
1 Three
2 Three
3 Three
4 Three
5 Three
6 Three
7 Three
8 Three
9 Three
10 Three
11 Three
12 Three
13 Three
14 Three
15 Three
16 Three
17 Three
18 Three
19 Three
20 Three
21 Three
22 Three
23 Three
24 Three
25 Three
26 Three
27 Three
28 Three
29 Three
30 Three
31 Three
32 Three
33 Three
34 Three
35 Three
36 Three
37 Three
38 Three
1 Four
2 Four
3 Four
4 Four
5 Four
6 Four
7 Four
8 Four
9 Four
10 Four
11 Four
12 Four
13 Four
14 Four
15 Four
16 Four
17 Four
18 Four
19 Four
20 Four
21 Four
22 Four
23 Four
24 Four
25 Four
26 Four
27 Four
28 Four
29 Four
30 Four
31 Four
32 Four
33 Four
34 Four
35 Four
36 Four
37 Four
38 Four

vspace

vspace
vspace

vspace
vspace

vspace
vspace

vspace
vspace

vspace
vspace

vspace
vspace

vspace

I noticed my app was a bit out of date, so I updated.

The above report is still accurate / the bug still occurs on this version:

SYSTEM INFO:
Obsidian version: v0.15.9
Installer version: v0.15.6
Operating system: Windows 10 Pro 10.0.19044
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none

I don’t consider the scrolling a bug, because this is the byproduct of the current limited implementation.
We should just scroll up to the top, since the cursor is placed there.