Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix annotation input focus trap regression in Safari #13229

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really needs a good comment, referencing the original issue, since it's less clear exactly what this does than in the previous code; I'd suggest:

        // Reset the cursor position to the start of the field (issue 12359).
        event.target.scrollLeft = 0;

When fixing this, please remember https://github.com/mozilla/pdf.js/wiki/Squashing-Commits and make sure that the patch has a proper commit message (not just PR description).

elementData.beforeInputSelectionRange = null;
};

Expand Down