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

Cannot switch between annotation layer form fields on Safari (macOS/iOS) #13191

Closed
CetinSert opened this issue Apr 7, 2021 · 6 comments
Closed

Comments

@CetinSert
Copy link
Contributor

CetinSert commented Apr 7, 2021

Attach (recommended) or Link to PDF file here: OoPdfFormExample.pdf

Configuration:

  • Web browser and its version: Safari – v14.0.3
  • Operating system and its version: macOS – Big Sur v11.2.3

(the issue persists in latest versions of Safari on iOS as well)

Steps to reproduce the problem:

  1. open attached PDF
  2. click/tap into the Given Name field
  3. click/tap into any other field

What is the expected behavior? (add screenshot)
Focus switches to the field from step 3

What went wrong? (add screenshot)
Focus stays stuck in the Given Name field.
Tab button does not work either.

@Snuffleupagus
Copy link
Collaborator

WFM, using PDF.js version 2.8.320 in Firefox Nightly.

Web browser and its version: Safari – v14.0.3

If this is specific to Safari, that'd suggest a bug in the browser itself rather than the PDF.js library.


For anyone trying to debug/fix this, please keep in mind that we'll generally not accept browser-specific compatibility hacks placed in the main code-base and such things should usually live in https://github.com/mozilla/pdf.js/blob/master/src/shared/compatibility.js

@CetinSert
Copy link
Contributor Author

This is specific to Safari - to which there is no alternative on iOS (tablets, phones).

@CetinSert
Copy link
Contributor Author

CetinSert commented Apr 7, 2021

  • removing contents of the entire viewer.css does not help.
  • clicking into developer tools (browser chrome (such as address bar) does not work) and back into an unfocused field does switch focus.

@CetinSert
Copy link
Contributor Author

CetinSert commented Apr 7, 2021

Steps to reproduce the problem:

  1. open attached PDF
  2. click/tap into the Given Name field
  3. click/tap into any other field
  • in step 3. viewer's own inputs (such as #pageNumber and #findInput) cannot be focused into either.

@CetinSert
Copy link
Contributor Author

CetinSert commented Apr 7, 2021

  • issue persists in other documents with forms.

@Snuffleupagus
Copy link
Collaborator

This looks, for all intents and purposes, like a duplicate of #12592.

CetinSert added a commit to pdf-ist-internal/pdf.js that referenced this issue Apr 12, 2021
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
CetinSert added a commit to pdf-ist-internal/pdf.js that referenced this issue Apr 13, 2021
setSelectionRange(0, 0); // required only by Firefox, causes issues in Safari (see mozilla#12592 and mozilla#13191).
scrollLeft = 0; // is a fix that breaks the focus trap in Safari while keeping Firefox behavior same.
CetinSert added a commit to pdf-ist-internal/pdf.js that referenced this issue Apr 13, 2021
setSelectionRange(0, 0); // required only by Firefox, causes issues in Safari (see mozilla#12592 and mozilla#13191).
scrollLeft = 0; // is a fix that breaks the focus trap in Safari while keeping Firefox behavior same for mozilla#12359
CetinSert added a commit to pdf-ist-internal/pdf.js that referenced this issue Apr 13, 2021
`setSelectionRange(0, 0)` added in mozilla@44b24fc for mozilla#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 mozilla#12359**.
CetinSert added a commit to pdf-ist-internal/pdf.js that referenced this issue Apr 13, 2021
`setSelectionRange(0, 0)` added in mozilla@44b24fc for mozilla#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 mozilla#12359**.
calixteman pushed a commit that referenced this issue Apr 13, 2021
`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**.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants