Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

When expanding hidden/folded regions in notebooks, the focused cell loses focus and focus moves to the notebook container. This breaks the expected interaction flow since the user is actively working with the cell.

Changes

foldingController.ts

  • Added editor.focusElement(cell) after the notebook.unfold command expands cells, matching the existing pattern in notebook.fold

foldedCellHint.ts

  • Added this._notebookEditor.focusElement(element) after the expand button handler expands the folded region

Both changes align with existing focus handling patterns: the folding icon click handler (line 142) and fold command (line 250) already maintain focus after collapsing.

Original prompt

This section details on the original issue you should resolve

<issue_title>Should cell input lose focus when hidden lines are expanded?</issue_title>
<issue_description>Testing #228393

  • Focus the cell
  • When you expand a hidden region, the focused cell loses focus and the whole notebook is focused.
  • I am wondering if it would make sense to keep the focus on the cell since we interact with the cell?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix cell input focus when expanding hidden lines Fix: Maintain cell focus when expanding hidden regions in notebooks Dec 10, 2025
Copilot AI requested a review from DonJayamanne December 10, 2025 02:37
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.

Should cell input lose focus when hidden lines are expanded?

2 participants