diff --git a/webapp/src/widgets/editable.tsx b/webapp/src/widgets/editable.tsx index 3be215e42..997dda704 100644 --- a/webapp/src/widgets/editable.tsx +++ b/webapp/src/widgets/editable.tsx @@ -24,11 +24,11 @@ export default class Editable extends React.Component { } public focus(): void { - this.elementRef.current!.focus() - - // Put cursor at end - document.execCommand('selectAll', false, undefined) - document.getSelection()?.collapseToEnd() + if (this.elementRef.current) { + const valueLength = this.elementRef.current.value.length + this.elementRef.current.focus() + this.elementRef.current.setSelectionRange(valueLength, valueLength) + } } public blur = (): void => {