Skip to content

Commit

Permalink
Fix annotation input focus trap regression in Safari (#13232)
Browse files Browse the repository at this point in the history
`setSelectionRange(0, 0)` added in 44b24fc for #12359, required only by Firefox ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=860329)), causes issues #13191, #12592 in Safari.
`scrollLeft = 0` is a fix that breaks the focus trap in Safari while **keeping Firefox behavior same for #12359**.
  • Loading branch information
CetinSert committed Apr 13, 2021
1 parent 3d2d800 commit d498897
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
if (elementData.formattedValue) {
event.target.value = elementData.formattedValue;
}
event.target.setSelectionRange(0, 0);
// Reset the cursor position to the start of the field (issue 12359).
event.target.scrollLeft = 0;
elementData.beforeInputSelectionRange = null;
};

Expand Down

0 comments on commit d498897

Please sign in to comment.