File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/packages/frontend/editors/slate/slate-react/plugin Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,13 @@ export const ReactEditor = {
166
166
// it's very important to restore the selection to where it was before
167
167
// focusing, since otherwise the selection is reset to the top of the document.
168
168
Transforms . setSelection ( editor , selection ) ;
169
+ // Critical to update the DOM selection ASAP, but not in same render loop (since that's too soon).
170
+ // Note that useLayoutEffect is not quick enough and things get broken without this below. An example
171
+ // is in virtualized mode when moving a list item down in a list.
172
+ const { updateDOMSelection } = editor ;
173
+ if ( updateDOMSelection != null ) {
174
+ window . requestAnimationFrame ( updateDOMSelection ) ;
175
+ }
169
176
}
170
177
} ,
171
178
You can’t perform that action at this time.
0 commit comments