You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a Give form is on the same page twice (e.g. as an embedded form and modal form), the "Show Terms" button will slide open terms and immediately close them. This happens because the inline script is output twice and also because its selector is not specific to the form instance.
Clicking "Show Terms" should only toggle terms for that form.
Current Behavior
Clicking "Show Terms" is running multiple times and toggling terms for all instances of the form on the page
Possible Solution
Two things:
This script should not be output as an inline script; it should be part of the enqueued give.min.js script. As an inline script, it gets output for every instance of the form on the page, causing slideToggle to run more than once per click.
The selector used to trigger slideToggle should be more specific so as to only target the terms in the same form. This could be done by using a combination of jQuery's this, parent(), and siblings().
Steps to Reproduce (for bugs)
Create a form with terms.
Add it to the same page twice.
Click Show Terms and confirm that the terms slide open and then close immediately.
The text was updated successfully, but these errors were encountered:
Issue Overview
If a Give form is on the same page twice (e.g. as an embedded form and modal form), the "Show Terms" button will slide open terms and immediately close them. This happens because the inline script is output twice and also because its selector is not specific to the form instance.
See https://github.com/WordImpress/Give/blob/master/includes/forms/template.php#L1661-L1668
Expected Behavior
Clicking "Show Terms" should only toggle terms for that form.
Current Behavior
Clicking "Show Terms" is running multiple times and toggling terms for all instances of the form on the page
Possible Solution
Two things:
This script should not be output as an inline script; it should be part of the enqueued
give.min.js
script. As an inline script, it gets output for every instance of the form on the page, causingslideToggle
to run more than once per click.The selector used to trigger
slideToggle
should be more specific so as to only target the terms in the same form. This could be done by using a combination of jQuery'sthis
,parent()
, andsiblings()
.Steps to Reproduce (for bugs)
The text was updated successfully, but these errors were encountered: