From ac4e8a682fa166f315871468e4138bc8fedc957e Mon Sep 17 00:00:00 2001 From: Cetin Sert Date: Mon, 12 Apr 2021 15:57:52 +0900 Subject: [PATCH] Fixes #13191 and #12592, ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This causes issues on Safari (see #12592 and #13191). Just removing the line fixes the issues and no difference / regression in behavior was observed without the `event.target.setSelection(0, 0);` bit in other browsers (including Firefox). The blur (switching focus out of the control) does effectively achieve the same thing in all browsers I have tested on. Tested specifically in Firefox with 1. inspect a `TextWidgetAnnotation` `input` element 2. `$0.setSelectionRange = (a, b) => console.warn(a, b);` 3. type `wow` and select `wow` in the input element 4. click/tab/tap outside the input element 5. CTRL + C ➡ no `wow` ✔ copied 6. CTRL + V ➡ confirmed --- src/display/annotation_layer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 84b3875cd6e6d..cd7fb683f257c 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -668,7 +668,6 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { if (elementData.formattedValue) { event.target.value = elementData.formattedValue; } - event.target.setSelectionRange(0, 0); elementData.beforeInputSelectionRange = null; };