Skip to content

Commit

Permalink
🦧 Fix #2548
Browse files Browse the repository at this point in the history
Co-Authored-By: Paul Berg <[email protected]>
  • Loading branch information
fonsp and Pangoraw committed Sep 18, 2023
1 parent a7a424c commit 62f7898
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions frontend/components/CellInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,16 @@ export const CellInput = ({
if (!caused_by_window_blur) {
// then it's caused by focusing something other than this cell in the editor.
// in this case, we want to collapse the selection into a single point, for aesthetic reasons.
view.dispatch({
selection: {
anchor: view.state.selection.main.head,
},
scrollIntoView: false,
})
// and blur the DOM again (because the previous transaction might have re-focused it)
view.contentDOM.blur()
setTimeout(() => {
view.dispatch({
selection: {
anchor: view.state.selection.main.head,
},
scrollIntoView: false,
})
// and blur the DOM again (because the previous transaction might have re-focused it)
view.contentDOM.blur()
}, 0)

set_cm_forced_focus(null)
}
Expand Down

0 comments on commit 62f7898

Please sign in to comment.