Open Bug 1880587 Opened 2 years ago Updated 2 years ago

Findbar auto case sensitivity doesn't work in PDF viewer pages

Categories

(Firefox :: PDF Viewer, defect, P3)

defect

Tracking

()

People

(Reporter: aminomancer, Unassigned)

Details

Steps to reproduce the problem:

  1. Set accessibility.typeaheadfind.casesensitive to 2 (this sets it to auto)
  2. Open any PDF file with text
  3. Open the findbar (Ctrl+F)
  4. Look for a string in the PDF that has uppercase letters. For example, in my testing, I found the word "MAP" in my PDF
  5. For the string you found, type it into the findbar, but lowercase. So for the word "MAP", I searched "map"

What is the expected behavior?

The finder should find uppercase instances of the string you typed into the findbar

What went wrong?

The finder does not find uppercase instances. It behaves as if case sensitivity is set to 1 (sensitive) — and in fact, it effectively is. You can test this by opening the browser console while the PDF viewer tab is active, and entering gFindBar.browser.finder._caseSensitive into the console. It returns true, which is incorrect.

Case sensitivity is supposed to work like this. When the pref is set to 2, it should be insensitive by default, and only be sensitive when there are uppercase letters in the findbar search string. And in these STR, we typed a lowercase string into the findbar, so it should be insensitive. On normal tabs (not PDF viewer), if you repeat those steps, it returns false. So this problem is specific to the PDF viewer.

The PDFJs actor and viewer.mjs have special finder handling, so I suspect the issue is in there. It seems like the viewer.mjs code reads the checked state of the findbar's checkboxes, rather than reading the internal state of the browser's Finder instance. So that might be related. But if that was the only issue, I would still expect "auto" not to work, but I would expect it to always behave insensitively, since the checkbox is not checked; but instead, the opposite is happening: it is always case sensitive, no matter what is typed in the findbar.

Thank you! Let me know if you need any more info from me. I am happy to help with debugging.

Edit: By the way, I don't have an easy way of testing this, but I suspect the same problem might be happening with "Match Diacritics." Unlike "Highlight All" and "Whole Words," the "Case Sensitive" and "Match Diacritics" settings are not boolean; they have 3 possible values: on, off, and auto/smart. Their behavior is very similar:

  • 0 = ignore case/diacritics
  • 1 = match case/diacritics
  • 2 = ignore case/diacritics in the content unless the search string contains uppercase/diacritics

So if there's a problem with accessibility.typeaheadfind.casesensitive = 2, then I'd also double check for a problem with findbar.matchdiacritics = 2

The severity field is not set for this bug.
:calixte, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(cdenizet)
Severity: -- → S3
Flags: needinfo?(cdenizet)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.