Skip to content

Commit

Permalink
chore(FormEditor): focus returns when disabled is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisVorop committed Jul 26, 2023
1 parent 9f7eb71 commit 346c9cb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/FormEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ export const FormEditor = React.forwardRef<HTMLDivElement, FormEditorProps>(
[open],
);

useEffect(() => {
if (!disabled) return;
onEditorBlur();

extraRef.current?.focus();
extraRef.current?.blur();
return () => {
monacoEditorRef.current?.focus();
};
}, [disabled]);

return (
<div tabIndex={0} ref={extraRef} style={{ outline: 'none' }} onPaste={onEditorPaste}>
<StyledEditor
Expand Down

0 comments on commit 346c9cb

Please sign in to comment.