Forms: fix 'Don't show this again' checkbox only dismissing on Got it click#47943
Forms: fix 'Don't show this again' checkbox only dismissing on Got it click#47943
Conversation
The FormsHelpModal used the same handler for both the "Got it" button and the modal's onRequestClose (X button / Escape). This meant checking the checkbox and then closing via X permanently dismissed the modal, with no way for the user to change their mind. Split the handlers so the dismiss API call only fires when the user explicitly clicks "Got it". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Proposed changes
onRequestClose(X / Escape) shared the same handler as the "Got it" button, so checking the checkbox and then closing via X would permanently dismiss the modal with no way to undo.Other information
The fix separates the modal's
onRequestClosehandler (which now just callsonClose) from the "Got it" button handler (renamed tohandleSubmit), which checks the checkbox state before calling the dismiss API.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Make sure that the option "jetpack_forms_classic_state" is set to "classic". This will make the button that shows the modal appear. You can do this in
/wp-admin/options.php