FIX: Prevent scroll when focus

This are fixes to make the widget embedable
This commit is contained in:
Nicolás Hatcher
2025-06-29 00:17:23 +02:00
committed by Nicolás Hatcher Andrés
parent 5744ae4d77
commit 97d3b04772
2 changed files with 2 additions and 2 deletions

View File

@@ -114,7 +114,7 @@ const Editor = (options: EditorOptions) => {
} }
} }
if (type === cell.focus) { if (type === cell.focus) {
textareaRef.current?.focus(); textareaRef.current?.focus({ preventScroll: true });
} }
}); });

View File

@@ -48,7 +48,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
); );
const focusWorkbook = useCallback(() => { const focusWorkbook = useCallback(() => {
if (rootRef.current) { if (rootRef.current) {
rootRef.current.focus(); rootRef.current.focus({ preventScroll: true });
// HACK: We need to select something inside the root for onCopy to work // HACK: We need to select something inside the root for onCopy to work
const selection = window.getSelection(); const selection = window.getSelection();
if (selection) { if (selection) {