From 0e5bd855f301e3be33ede4426a313c9a703af82e Mon Sep 17 00:00:00 2001 From: "Gpound.liu" <141617023+Gggpound@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:22:46 +0800 Subject: [PATCH] fix(range-selector): focus after confirm (#4029) --- .../sheets-formula-ui/src/views/range-selector/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/sheets-formula-ui/src/views/range-selector/index.tsx b/packages/sheets-formula-ui/src/views/range-selector/index.tsx index 8d5e4feb989..904f2a7bb5a 100644 --- a/packages/sheets-formula-ui/src/views/range-selector/index.tsx +++ b/packages/sheets-formula-ui/src/views/range-selector/index.tsx @@ -318,14 +318,19 @@ export function RangeSelector(props: IRangeSelectorProps) { rangeDialogVisibleSet(false); onRangeSelectorDialogVisibleChange(false); setTimeout(() => { + isFocusSet(true); editor?.setSelectionRanges([{ startOffset: text.length, endOffset: text.length }]); + focus(); }, 30); }; const handleClose = () => { rangeDialogVisibleSet(false); onRangeSelectorDialogVisibleChange(false); - setTimeout(focus, 30); + setTimeout(() => { + isFocusSet(true); + focus(); + }, 30); }; const handleOpenModal = () => { @@ -335,6 +340,7 @@ export function RangeSelector(props: IRangeSelectorProps) { setTimeout(() => { rangeDialogVisibleSet(true); onRangeSelectorDialogVisibleChange(true); + isFocusSet(false); }, 30); } };