Skip to content

Fix stdin input triggering cell re-execution on Shift+Enter#17565

Merged
krassowski merged 1 commit into
jupyterlab:mainfrom
Darshan808:fix-stdin
May 21, 2025
Merged

Fix stdin input triggering cell re-execution on Shift+Enter#17565
krassowski merged 1 commit into
jupyterlab:mainfrom
Darshan808:fix-stdin

Conversation

@Darshan808

Copy link
Copy Markdown
Member

Fixes #17564

Description

This PR updates the Stdin widget to call event.stopPropagation() at the very beginning of the handleEvent method. This ensures that key events like Shift+Enter do not bubble up to notebook-level handlers, preventing unintended cell re-execution.

@jupyterlab-probot

Copy link
Copy Markdown

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty neat. Fixes the issue, I tested this with:

x = None
while x != "x":
    x = input()

and holding Shift + Enter.

I wondered if any other function could be affected by this change, but I tested that tab navigation, arrow navigation and search still work.

@krassowski krassowski added this to the 4.4.x milestone May 21, 2025
@krassowski krassowski merged commit 026d862 into jupyterlab:main May 21, 2025
84 of 85 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/jupyterlab that referenced this pull request May 21, 2025
krassowski pushed a commit that referenced this pull request May 22, 2025
…hift+Enter (#17585)

Co-authored-by: Darshan Poudel <pranishpoudel10@gmail.com>
kjayan pushed a commit to kjayan/jupyterlab that referenced this pull request Jun 10, 2025
@github-actions github-actions Bot added the status:resolved-locked Closed inactive issues are locked after a while. Please open a new issue for related discussion. label Feb 14, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug pkg:outputarea status:resolved-locked Closed inactive issues are locked after a while. Please open a new issue for related discussion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pressing Shift+Enter inside stdin input triggers cell re-execution

2 participants