Skip to content

notebook scrolls up incorrectly when adjusting output heights #193231

Closed

Description

@amunger
  1. create a notebook that has several cells, and put this code in the second to last cell
import time
time.sleep(2)
for i in range(18):
    print(i)
print('end of output')
  1. execute the cell so that it has output, and shrink the window so that the single cell+output takes up the whole scrollable region
  2. execute the cell again with shift+enter

🐛 the notebook ends up scrolling up, instead of showing the full output and next cell.

Recording 2023-09-15 at 11 31 00

Activity

  1. amunger commented on Sep 15, 2023

    @amunger
    CollaboratorAuthor

    The current behavior of the list view is to use the second visible element as an anchor which can cause some strange behavior.

    In this scenario:

    1. The next cell is focused and revealed, making that cell the anchor as second visible, since the executing cell takes up the rest of the visible region.
    2. The output is removed, moving more elements into view from above
    3. Output is added and the initial anchor is no longer the second element, so it is scrolled out of view

    I'll try to play around with some options, but my initial thought would be to use the executing cell as the anchor. The output could expand and push the next cell out of view, but typing in that cell will bring it back into view.

    cc João Moreno (@joaomoreno)

  2. joaomoreno commented on Sep 22, 2023

    @joaomoreno
    Contributor

    I wanted to see the behavior locally. I really can't seem to repro this, my notebook stays pretty stable as the cell shrinks and grows. What am I missing?

    Screen.Recording.2023-09-22.at.12.14.52.mov
  3. joaomoreno commented on Sep 22, 2023

    @joaomoreno
    Contributor

    I think I found it. Aaron Munger (@amunger), I believe you have editor.scrollBeyondLastLine disabled, am I correct? Can you reproduce this when flipping that setting back to the default value of true?

  4. added
    under-discussion
    on Sep 22, 2023
  5. amunger commented on Sep 22, 2023

    @amunger
    CollaboratorAuthor

    It repro's with or without editor.scrollBeyondLastLine - you just need to scroll down enough so that the resized cell is only partially visible.

    The strange behavior is due to the notebook cell list setting different anchors depending on whether the element top is above the render top. https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L1219C2-L1219C2

  6. added
    unreleased
    on Sep 22, 2023
  7. added
    insiders-released
    and removed
    unreleased
    on Sep 25, 2023
  8. joaomoreno commented on Sep 25, 2023

    @joaomoreno
    Contributor

    As I looked into the remaining open issue #193835 and PR #193530, I was trying to grasp what the issue really is, what has been actually fixed and what's left to fix.

    Then, I pulled latest and ran out of sources and this is even worse than my last recording. Everything jumps around even when the cell is fully in view:

    Screen.Recording.2023-09-25.at.09.02.07.mov

    Did #193833 just break this even more?

    Aaron Munger (@amunger) I suggest reverting #193833, pausing, simplifying the problem, narrowing in on a solution and consider fixing it in debt week so as to not cause regressions during this endgame week.

    cc Peng Lyu (@rebornix)

  9. added
    important
    on Sep 25, 2023
  10. 4 remaining items

  11. added
    important
    on Sep 25, 2023
  12. rebornix commented on Sep 25, 2023

    @rebornix
    Contributor

    João Moreno (@joaomoreno) thanks for the testing, the two recordings you posted above were using different execution commands so I want to ensure we refer to the same behavior:

    João Moreno (@joaomoreno) can you confirm if this is what you are seeing?

  13. rebornix commented on Sep 25, 2023

    @rebornix
    Contributor

    I captured a recording for what probably João Moreno (@joaomoreno) was comparing, right side is Stable and left side Insiders

    • In both setup, the next cell is fully visible
    • In Stable, shift+enter moves the next cell up, and then push it down, but the new focused cell is still visible in the viewport at the end
    • In Insiders, shift+enter moves the next cell up, and when the previous starts to grow, it does not move the focused cell downwards
    Screen.Recording.2023-09-25.at.8.13.02.AM.mov

    Even though the new behavior is more self explanatory (from our perspective), but unluckily is not the same as Jupyter Lab. It means we are changing from one custom behavior (our previous heuristics) to another (always keep focused cell stable)

  14. joaomoreno commented on Sep 25, 2023

    @joaomoreno
    Contributor

    Thanks for clarifying this Peng Lyu (@rebornix). It was not clear to me that (1) shift+enter and clicking the run cell action did different things, nor that (2) this bug was only about one of these actions.

  15. removed
    important
    on Sep 25, 2023
  16. removed their assignment
    on Oct 5, 2023
  17. amunger commented on Oct 19, 2023

    @amunger
    CollaboratorAuthor

    fixed by #195283

  18. locked and limited conversation to collaborators on Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugnotebook-outputverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions