mirror of
https://github.com/outline/outline.git
synced 2026-11-25 15:15:15 +03:00
fix: Crash inserting a math block from the suggestions menu (#13495)
Opening the nested math editor moves focus, which dismisses the suggestions menu. Restoring focus to the outer view re-entered the node view's selection handling before it had finished, throwing "inner view should not exist!". Fixes OUTLINE-CLOUD-BZA Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e7249cb138
commit
54ccfc76bb
1 file changed
+7
-1
@@ -419,7 +419,13 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
|
||||
const close = React.useCallback(() => {
|
||||
props.onClose();
|
||||
view.focus();
|
||||
|
||||
// Don't steal focus back from a nested editor, such as the one inside a
|
||||
// math node, that took it while the menu was closing.
|
||||
const focused = view.dom.ownerDocument.activeElement;
|
||||
if (focused === view.dom || !view.dom.contains(focused)) {
|
||||
view.focus();
|
||||
}
|
||||
}, [props, view]);
|
||||
|
||||
const handleLinkInputKeydown = (
|
||||
|
||||
Reference in new issue
Block a user