Skip to content

fix: add InputFocusedContext guard to notebook output Escape keybinding#308695

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/notebook-escape-keybinding-output-focused
Open

fix: add InputFocusedContext guard to notebook output Escape keybinding#308695
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/notebook-escape-keybinding-output-focused

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

Fixes #234235

The Escape keybinding for "Notebook: Stop Editing Cell" when notebook output is focused (notebookEditorFocused && notebookOutputFocused) was missing an InputFocusedContext.toNegated() guard. This caused the keybinding to incorrectly fire when a user pressed Escape to dismiss autocomplete suggestions while editing a cell, because the NOTEBOOK_OUTPUT_FOCUSED context key could remain stale from a previous output focus.

  • Added InputFocusedContext.toNegated() to the output-focused Escape keybinding's when condition
  • This ensures the keybinding only triggers when no input element has focus, preventing it from interfering with editor actions like dismissing the suggest widget

Test plan

  • Open a notebook and edit a code cell
  • Type something to trigger the autocomplete popup
  • Press Escape to dismiss the popup
  • Verify the cell remains in edit mode (focus is not lost)
  • Click on a cell output to focus it, then press Escape
  • Verify focus properly returns to the cell container (existing behavior preserved)

The Escape keybinding for 'Stop Editing Cell' when notebook output is
focused was missing an InputFocusedContext.toNegated() guard. This caused
the keybinding to incorrectly fire when a user pressed Escape to dismiss
autocomplete suggestions while editing a cell, because the
NOTEBOOK_OUTPUT_FOCUSED context key could remain stale from a previous
output focus.

Adding the InputFocusedContext.toNegated() condition ensures this
keybinding only triggers when no input element has focus, preventing it
from interfering with editor input actions like dismissing completions.

Fixes microsoft#234235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard shortcut issue: duplicated "Notebook: Stop Edting Cell" bound with **Esc** key

2 participants