Files
pdfcraft/parity
Eric Kaden 30dfab44ff Forms: a push button takes the focus on a click and as a Tab stop (#4589)
* M6: a field's mouse and focus actions run as the pointer and the focus move

Every trigger of ISO 32000-2 Table 197 runs its action: Mouse Enter and Exit as the pointer arrives over a widget and leaves it, Mouse Down on a press (before the field the focus leaves commits), On Blur and On Focus with #4359's focus scripts, and Mouse Up on the release once they have run, which a push button's click now waits for too. Order and event.name values measured black-box on a synthetic form. forms::widget_action reads any trigger's action; Session::run_field_script runs a script as that field event; form_trigger runs one headlessly.

* M6: only a click's field actions may print, open links or Save As

A field's Mouse Enter, Mouse Exit, Focus and Blur actions run without anyone asking: their scripts' requests to print, open a link or Save As, or show a side panel are dropped and noted on the console, and an action that runs a menu item, opens a link, submits or picks a picture doesn't run. Mouse Down and Up, a click, keep them.

* M6: a trigger's reset or show/hide keeps the typing a press committed

A press commits the field it leaves into the view's queued edit, and a Mouse Down reset or show/hide action replaced that queued edit, losing the typing. A trigger's reset or show/hide now applies at once, and the queued commit applies after it, as another viewer orders a press's Mouse Down before the field left commits. action_edit builds the edit for both a push button's click and a trigger.

* M6: a push button takes the focus on a click and as a Tab stop

Another viewer gives a push button the focus when it is clicked, and stops at it on Tab (probe 10: Tab from a text field reached the button; a click on it ran Mouse Down, the field left's Blur, its Focus, then Mouse Up). PdfCraft's push buttons took none, so their On Focus and On Blur never ran and Tab skipped them. A click now focuses the button as it does a check box, Tab and Shift+Tab include push buttons, and Space or Enter presses the focused button. The check box's keyboard holder is shared as hold_keys.

* M6: a test that XFA focus scripts may not print, open links or Save As

The XFA runner already drops these for any activity but a click; the test holds enter and exit to the same rule as an AcroForm field's Focus and Blur.

* M6: hovering a form that may not be filled in runs none of its actions

Mouse Enter and Exit ran where the document's security forbids filling in the form, as Mouse Down and the other actions don't: a script changing a value was refused on every pass, with a message each time. The hover is noted only where the form may be filled in.

* M6: a reset by a field's action shows in the editor of the field being edited, as a script's change does

* M6: a push button scrolled out of view lets go of the focus, as a check box does
2026-12-04 14:42:36 +01:00
..