From 184b2f1b2574094c347c20e78d73c042b34a83d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 17 Nov 2020 19:40:40 +0100 Subject: [PATCH] Fixed firefox incompatiblity --- webapp/src/widgets/editable.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 => {