Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter notebook jumps to top of cell on Ctrl-Enter #7323

Open
soerenwolfers opened this issue Apr 13, 2024 · 9 comments
Open

Jupyter notebook jumps to top of cell on Ctrl-Enter #7323

soerenwolfers opened this issue Apr 13, 2024 · 9 comments
Labels

Comments

@soerenwolfers
Copy link

Description

When I hit Ctrl-Enter while in line number >40 of a cell with 50 lines and I'm scrolled towards the bottom of the cell such that lines 1-40 aren't visible, then the view jumps to the top of the cell.

Reproduce

  1. Create new notebook
  2. Create one trivial line with 1 and 49 empty lines
  3. Scroll down to bottom of cell, make sure top of cell isn't visible anymore
  4. Hit Ctrl-Enter

Expected behavior

View doesn't move

Context

  • Operating System and version: Linux Ubuntu 22
  • Browser and version: 122.0.6261.128 (Official Build) (64-bit)
  • Jupyter Notebook version: 7.1.1
Troubleshoot Output sys.version: 3.12.2 (main, Feb 25 2024, 16:36:57) [GCC 9.4.0]

platform.platform():
Linux-5.15.0-101-generic-x86_64-with-glibc2.31

pip list:
Package Version Editable project location
--------------------------------- --------------- --------------------------
anyio 4.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
awkward 2.6.3
awkward-cpp 32
Babel 2.14.0
beautifulsoup4 4.12.3
bleach 6.1.0
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 3.3.2
comm 0.2.1
debugpy 1.8.1
decorator 5.1.1
defusedxml 0.7.1
duckdb 0.10.2.dev311
duckdf 0.0.1 /home/soeren/duckdf/duckdf
executing 2.0.1
fastjsonschema 2.19.1
fqdn 1.5.1
fsspec 2024.3.1
h11 0.14.0
httpcore 1.0.4
httpx 0.27.0
idna 3.6
ipykernel 6.29.3
ipython 8.22.1
ipython-genutils 0.2.0
ipywidgets 8.1.2
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.3
json5 0.9.18
jsonpointer 2.4
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter 1.0.0
jupyter_client 8.6.0
jupyter-console 6.6.3
jupyter_contrib_core 0.4.2
jupyter_contrib_nbextensions 0.7.0
jupyter_core 5.7.1
jupyter-events 0.9.0
jupyter-highlight-selected-word 0.2.0
jupyter-lsp 2.2.3
jupyter-nbextensions-configurator 0.6.3
jupyter_server 2.12.5
jupyter_server_terminals 0.5.2
jupyterlab 4.1.2
jupyterlab-execute-time 3.1.2
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.3
jupyterlab_widgets 3.0.10
line-profiler 4.1.2
llvmlite 0.42.0
lxml 5.1.0
MarkupSafe 2.1.5
matplotlib-inline 0.1.6
mistune 3.0.2
nbclient 0.9.0
nbconvert 7.16.1
nbformat 5.9.2
nest-asyncio 1.6.0
notebook 7.1.1
notebook_shim 0.2.4
numba 0.59.1
numpy 1.26.4
overrides 7.7.0
packaging 23.2
pandas 2.2.1
pandocfilters 1.5.1
parso 0.8.3
pexpect 4.9.0
pip 24.0
platformdirs 4.2.0
polars 0.20.13
prometheus_client 0.20.0
prompt-toolkit 3.0.43
psutil 5.9.8
ptyprocess 0.7.0
pure-eval 0.2.2
pyarrow 15.0.0
pycparser 2.21
Pygments 2.17.2
python-dateutil 2.9.0.post0
python-json-logger 2.0.7
pytz 2024.1
PyYAML 6.0.1
pyzmq 25.1.2
qtconsole 5.5.1
QtPy 2.4.1
referencing 0.33.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.0
scipy 1.13.0
Send2Trash 1.8.2
setuptools 69.1.1
six 1.16.0
sniffio 1.3.1
soupsieve 2.5
stack-data 0.6.3
tabulate 0.9.0
terminado 0.18.0
tinycss2 1.2.1
tornado 6.4
traitlets 5.14.1
types-python-dateutil 2.8.19.20240106
tzdata 2024.1
uri-template 1.3.0
urllib3 2.2.1
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.7.0
widgetsnbextension 4.0.10

Browser Output Nothing on cell click
@soerenwolfers soerenwolfers added bug status:Needs Triage Applied to issues that need triage labels Apr 13, 2024
@RRosio
Copy link
Collaborator

RRosio commented Apr 16, 2024

Thank you for opening this issue @soerenwolfers. Is this a change from the behavior you have seen in Notebook 6?

@soerenwolfers
Copy link
Author

@RRosio not sure but I think it should be changed regardless. If anything, you might argue that it should jump to get the cell output into view, but I can never imagine wanting to see the first input line after running a cell (unless it was already visible before)

@RRosio RRosio removed status:Needs Info status:Needs Triage Applied to issues that need triage labels Apr 23, 2024
@jtpio
Copy link
Member

jtpio commented May 1, 2024

Thanks @soerenwolfers for reporting.

Yes this is reproducible with the latest 7.2.0rc0 version:

notebook-scroll-ctrl-enter.webm

It is indeed quite annoying. But it looks like it's also an issue in JupyterLab, so maybe we'll have to fix it there so it's fixed here in Notebook 7:

jupyterlab-scroll-issue.webm

@jtpio
Copy link
Member

jtpio commented May 1, 2024

But it looks like it's also an issue in JupyterLab, so maybe we'll have to fix it there so it's fixed here in Notebook 7:

Do we have an issue reporting the same problem in JupyterLab?

@89sundown
Copy link

I'm also having the same problem. Did you find a solution?

@jtpio
Copy link
Member

jtpio commented Oct 22, 2024

This is likely the same isssue as the one in JupyterLab: jupyterlab/jupyterlab#15968

@burnpanck
Copy link

As the original author of jupyterlab/jupyterlab#15968, I can clearly say that these two are distinct behaviours, though both are annoying. (any screen jerk is annoying -> #7317). Here, the screen jerk is triggered by shift-enter; in jupyterlab/jupyterlab#15968 it is triggered by scrolling.

@krassowski
Copy link
Member

I agree. Of note, I fixed similar issues previously:

I think what is different this time is that it's not the cell outputs that define a long cell but the cell editor contents. Either the scrolling logic does not account for it, or (what I suspect is quit likely) there is an interaction between CodeMirror editor loosing focus and our scrolling logic which makes the cell erroneously scroll to the top.

@krassowski
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants