ソースを参照

Wrap dispatchSelectionAndScroll in setTimeout (#22596)

GitOrigin-RevId: 8c2c27acdbbf0e8879978e307ccf952c1be5381e
Alf Eaton 1 年間 前
コミット
e1f880a62b

+ 6 - 5
services/web/frontend/js/features/source-editor/extensions/cursor-position.ts

@@ -122,12 +122,13 @@ const dispatchSelectionAndScroll = (
   view: EditorView,
   selection: SelectionRange
 ) => {
-  view.dispatch({
-    selection,
-    effects: EditorView.scrollIntoView(selection, { y: 'center' }),
+  window.setTimeout(() => {
+    view.dispatch({
+      selection,
+      effects: EditorView.scrollIntoView(selection, { y: 'center' }),
+    })
+    view.focus()
   })
-
-  view.focus()
 }
 
 export const setCursorLineAndScroll = (