Skip to content

Commit

Permalink
Fixes mozilla#13191 and mozilla#12592, ...
Browse files Browse the repository at this point in the history
This causes issues on Safari (see mozilla#12592 and mozilla#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. <kbd>CTRL</kbd> + <kbd>C</kbd> ➡ no `wow` ✔ copied
6. <kbd>CTRL</kbd> + <kbd>V</kbd> ➡ confirmed
  • Loading branch information
CetinSert authored Apr 12, 2021
1 parent a3669a4 commit ac4e8a6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
if (elementData.formattedValue) {
event.target.value = elementData.formattedValue;
}
event.target.setSelectionRange(0, 0);
elementData.beforeInputSelectionRange = null;
};

Expand Down

0 comments on commit ac4e8a6

Please sign in to comment.