Fix annotation input focus trap regression in Safari (#13232)

`setSelectionRange(0, 0)` added in 44b24fcc29 for #12359, required only by Firefox ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=860329)), causes issues mozilla#13191, mozilla#12592 in Safari.
`scrollLeft = 0` is a fix that breaks the focus trap in Safari while **keeping Firefox behavior same for #12359**.
This commit is contained in:
Cetin Sert 2021-04-14 03:40:52 +09:00 committed by GitHub
parent 3d2d8002b0
commit d498897ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
};