Skip to content

Commit d19bdef

Browse files
committed
Fix: table does not get proper focus when UIEditorLinked stops editing.
1 parent d97bf85 commit d19bdef

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/main/components/editors/linked/UIEditorLinked.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,6 @@ const UIEditorLinked: FC<IEditorLinked & IExtendableLinkedEditor & IComponentCon
12591259
}
12601260
focused.current = false;
12611261
}
1262-
12631262
}
12641263
else if (!linkedRef.current?.getElement()?.contains(event.relatedTarget)) {
12651264
if (props.eventFocusLost) {
@@ -1300,7 +1299,8 @@ const UIEditorLinked: FC<IEditorLinked & IExtendableLinkedEditor & IComponentCon
13001299
if (props.onSelect) {
13011300
props.onSelect(event);
13021301
}
1303-
handleSelect(event.value)
1302+
handleSelect(event.value);
1303+
setTimeout(() => handleEnterKey(event.originalEvent, event.originalEvent.target, props.name, props.stopCellEditing), 0);
13041304
}}
13051305
tooltip={props.toolTipText}
13061306
tooltipOptions={{ position: "left", showDelay: 800 }}

src/main/components/table/CellEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ export const CellEditor: FC<ICellEditor> = (props) => {
216216
}
217217
}
218218
}
219-
else {
220-
focusTable = selectNext("Enter");
221-
}
219+
// else { // Only key events should change selected cell
220+
// focusTable = selectNext("Enter");
221+
// }
222222
if (focusTable) {
223223
tableContainer.focus();
224224
}

src/main/util/other-util/HandleEnterKey.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function handleEnterKey(event:any, elem:any, name:string, stopEditing?:Fu
2727
event.preventDefault();
2828
elem.blur();
2929
if (stopEditing) {
30-
stopEditing(event)
30+
stopEditing(event);
3131
}
3232
else {
3333
if (event.shiftKey) {
@@ -38,4 +38,7 @@ export function handleEnterKey(event:any, elem:any, name:string, stopEditing?:Fu
3838
}
3939
}
4040
}
41+
else if (stopEditing) {
42+
stopEditing(null); // forces focus on table
43+
}
4144
}

0 commit comments

Comments
 (0)