Repository navigation
Conversation
…sue 22393) A value that a script sets on a field whose widgets aren't rendered yet goes into the annotation storage, and each radio button reads it when it renders. Two things went wrong there: - `PDFScriptingManager` stored the same object for every widget of the field, and `AnnotationStorage.setValue` updates the object it holds, so the boolean that the first radio button stored under its own id became the value of all of its siblings. - `RadioButtonWidgetAnnotationElement` turned the stored export value into `value !== data.buttonValue`, so the button whose export value was set rendered unchecked and the others checked. The first radio button showed checked, and every widget stored `false`. Each widget now gets its own copy, and a radio button is checked when the stored value is its export value, as in its `updatefromsandbox` handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22393.
When a script sets the value of a radio group whose page isn't rendered yet, the value goes into the annotation storage, and each radio button reads it when it renders. Two things went wrong there:
PDFScriptingManager.#updateFromSandboxstored the samedetailobject for every widget of the field, andAnnotationStorage.setValueupdates the object it holds, so the boolean that the first radio button stored under its own id became the value of all of its siblings.RadioButtonWidgetAnnotationElement.renderturned the stored export value intovalue !== data.buttonValue, so the button whose export value was set rendered unchecked and the others checked.The first radio button showed checked, and every widget stored
false, so the form saved no selection. Each widget now gets its own copy, and a radio button is checked when the stored value is its export value, as in itsupdatefromsandboxhandler. Neither change is enough alone: with only the comparison fixed, the first radio button storesfalseinto the shared object, and no button is checked.The integration test clicks a push button on page 1 of
issue22393.pdfwhose action sets the radio group on page 5, scrolls to page 5, and expects only the selected button to be checked and stored astrue. Locally, without this change, it fails in Chrome 156 and Firefox Nightly 161. With it, the integration tests inannotation_spec.mjsandscripting_spec.mjspass in both, except "must check that an infinite loop is not triggered", which times out in Firefox Nightly 161 on master too.🤖 Generated with Claude Code