Bug 472756 - Infinite modal dialog in PDF form
Summary: Infinite modal dialog in PDF form
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 23.04.3
Platform: Flatpak Linux
: NOR major
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-28 17:17 UTC by Juan Navarro
Modified: 2023-08-01 22:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Sample PDF file (1.33 MB, application/pdf)
2023-07-28 17:17 UTC, Juan Navarro
Details
Video showing the expected behavior (using Acrobat Reader) (1.14 MB, video/x-matroska)
2023-07-28 22:20 UTC, Juan Navarro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juan Navarro 2023-07-28 17:17:51 UTC
Created attachment 160593 [details]
Sample PDF file

SUMMARY

A modal dialog is shown by the PDF form I'm trying to fill. It is just an informative dialog. The problem is that once closed, it shows up immediately again. This repeats indefinitely, which causes the form to be unfillable, and what's worse, Okular is captive in this dialog-loop, so it cannot be even closed by normal means.

Using Okular v23.04.3, the latest version available in Flathub (https://flathub.org/apps/org.kde.okular) as of today. Underlying platform is Ubuntu 20.04.


STEPS TO REPRODUCE

1. Open the PDF file that I'm attaching to this report.

2. A header bar shows up in Okular, saying that "This document has forms. Click on the button to interact with them, or use View -> Show Forms."
Click the "Show Forms" button.

3. On the right-half of the document, on the first row that contains this text:
(2) Tipo de documento de identidad
DNI  Pasaporte  NIE  T. Residencia

Click on any of the checkboxes. For example, click on the checkbox under "DNI".

4. A dialog appears with this text:
(1) En caso de Tarjeta de Residencia, indicar T (Temporal), P(Permanente), C(Comunitaria)

And an OK button.


OBSERVED RESULT

Pressing the OK button closes the dialog, but it immediately appears again.
The application is then permanently captured by this modal dialog, and neither of progressing with filling the form, or closing Okular, is possible.


EXPECTED RESULT

Pressing the OK button would close the dialog permanently.

IF the reappearance of the dialog is caused by bad viewer logic of Okular:

* Okular should be fixed to improve compatibility with documents like this one.

IF the issue is caused by faulty logic of the document itself, and is not an issue in Okular itself, then:

* Okular might try to be useful: detect the case and inform the user about it.
* Okular ought to not allow a faulty document to make it into a dialog loop. For this, a reappearance limit would be a good idea, either as a fixed limit or as a UI checkbox in the dialog, giving the user the chance to silence future instances of that dialog. This is a pattern that I have seen successfully implemented in other software, such as web browsers.


SOFTWARE/OS VERSIONS
As per Flatpak package indicated above:

Name        Description          Application ID      Version      Branch      Remotes
Okular      Document Viewer      org.kde.okular      23.04.3      stable      flathub
Comment 1 Juan Navarro 2023-07-28 17:21:08 UTC
Further info:

This dialog doesn't show up at all in other PDF viewers I've tested:
* Xreader v3.2.2
* Firefox v115
* Chromium v114

While these are indeed missing to show part of the PDF form to the user, the lucky consequence of that is that it becomes possible to actually fill the form successfully.
Comment 2 Juan Navarro 2023-07-28 22:20:46 UTC
Created attachment 160597 [details]
Video showing the expected behavior (using Acrobat Reader)

Attaching a screen capture video where the expected behavior is shown.
This was captured using Acrobat Reader on Windows.
The "DNI", "Pasaporte" and "NIE" boxes can be marked as selected right away.
The "T", "P", and "C" boxes should show the modal dialog once, and afterwards they get marked as selected.
Comment 3 Bug Janitor Service 2023-07-31 21:53:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/785
Comment 4 Albert Astals Cid 2023-08-01 22:15:44 UTC
Git commit f940ca1e2eda350b6e556f21adbd330fc99f8bb2 by Albert Astals Cid.
Committed on 02/08/2023 at 00:07.
Pushed by aacid into branch 'master'.

Forms: Don't run focusin action when gaining focus because of window management

Adobe Reader doesn't do it, and with reason, because otherwise we end up
with:
 * Run focus in script
 * script shows alert()
 * form loses focus and gains it again once the alert() is closed
 * infinite loop

The same fix we did in e457ceb73146790c5d4a9914182433ab4002815e but for
the rest of the widgets

M  +1    -1    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/-/commit/f940ca1e2eda350b6e556f21adbd330fc99f8bb2
Comment 5 Albert Astals Cid 2023-08-01 22:16:37 UTC
Git commit 2e3163e621e84afd6d13429a6582ccdd9ea79c99 by Albert Astals Cid.
Committed on 02/08/2023 at 00:16.
Pushed by aacid into branch 'release/23.08'.

Forms: Don't run focusin action when gaining focus because of window management

Adobe Reader doesn't do it, and with reason, because otherwise we end up
with:
 * Run focus in script
 * script shows alert()
 * form loses focus and gains it again once the alert() is closed
 * infinite loop

The same fix we did in e457ceb73146790c5d4a9914182433ab4002815e but for
the rest of the widgets
(cherry picked from commit f940ca1e2eda350b6e556f21adbd330fc99f8bb2)

M  +1    -1    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/-/commit/2e3163e621e84afd6d13429a6582ccdd9ea79c99