Created attachment 138371 [details] An affected PDF. Select the SID field (top right) to trigger the bug. SUMMARY At least one example of a PDF with interactive forms is impossible to fill out with Okular. When a field with validation is selected, an error message is displayed explaining that the field is required and must have a certain format. When "Ok" is pressed, the message is immediately displayed again. When the close button on the message window is pressed, the message is immediately displayed again. Many clicks on the close button in rapid succession eventually causes the error window to not immediately be displayed again, until the field is selected again. The main window cannot be interacted with while the error window exists. STEPS TO REPRODUCE 1. Open a PDF with affected interactive forms using Okular 2. Select an affected field (one that has validation that brings up an error window) OBSERVED RESULT Error window immediately displayed, and is impossible to dismiss or ignore in order to fill out the field. EXPECTED RESULT Field can be edited, or a less obtrusive error is shown that does not interfere with editing the field. SOFTWARE/OS VERSIONS Windows: 10 Pro Version 10.0.19042 Build 19042 macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: 5.67.0 Qt Version: 5.14.1 Okular version: 1.10.70 (installed via Chocolatey) ADDITIONAL INFORMATION
Would a good fix be that the error message appears as hovering text field, or as a red background, instead of a blocking dialog? There are websites where form fields are shown as “invalid” instead of “incomplete” when you haven’t yet typed anything. I guess the same happens here.
It's not errors, it's messagebox popped up by the Javascript of the document, could very well be anything, so no they can't appear anyway else. I have not checked the code at all, but my guess the problem here is, that the file does: If the field has an won focus -> show messagebox saying what the field contents has to be But that makes it lose the focus to the messagebox and win it again, so If the field has an won focus -> show messagebox saying what the field contents has to be etc. etc. Would need time to check that is indeed the problem and make it realize that if it's winning the focus and had it and was lost because a mesagebox was shown, there's no need to show the messagebox again. And also check what Adobe Reader does with the file, because it's super easy to infinite loop firefox too
Git commit 37aacc7f8bba67e0ec6b4854d901fe9dab4a8efd by Albert Astals Cid. Committed on 24/05/2021 at 22:26. Pushed by aacid into branch 'okular_focus_actions'. FormLineEdit: 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() * field loses focus and gains it again once the alert() is closed * infinite loop M +6 -2 part/formwidgets.cpp https://invent.kde.org/graphics/okular/commit/37aacc7f8bba67e0ec6b4854d901fe9dab4a8efd
I made a mistake and push it to the wrong branch, fix has still not landed
Git commit e457ceb73146790c5d4a9914182433ab4002815e by Albert Astals Cid. Committed on 04/06/2021 at 21:17. Pushed by aacid into branch 'release/21.04'. FormLineEdit: 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() * field loses focus and gains it again once the alert() is closed * infinite loop M +6 -2 part/formwidgets.cpp https://invent.kde.org/graphics/okular/commit/e457ceb73146790c5d4a9914182433ab4002815e