Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double click prevention #6393

Open
laryn opened this issue Jan 31, 2024 · 5 comments · May be fixed by backdrop/backdrop#4648
Open

Double click prevention #6393

laryn opened this issue Jan 31, 2024 · 5 comments · May be fixed by backdrop/backdrop#4648

Comments

@laryn
Copy link
Contributor

laryn commented Jan 31, 2024

Description of the need

I was working on a form that has a bit of a lag as it checks something via an external API, and started looking into double click prevention. It turns out it was added to Drupal 7 in 7.98 -- should we add it to Backdrop as well?

@klonos
Copy link
Member

klonos commented Feb 3, 2024

I thought we already sorted that with #2595 🤔 ...there's also #3717 as a follow-up.

@klonos
Copy link
Member

klonos commented Feb 3, 2024

...right, it seems that we are missing a few things from this commit, plus also this one which introduces the new drupal.form-single-submit library.

So yeah, we should do that 👍🏼 ...but if we brought code parity with these commit, then I believe that we can close #3717 as redundant(?).

@klonos
Copy link
Member

klonos commented Feb 3, 2024

...I'm assigning this to myself, to knock it out of the way.

@klonos
Copy link
Member

klonos commented Feb 4, 2024

So the way things were implemented in D7, the JS that does the double-click prevention was added into a separate file, loaded via the system_library(), whereas we have added it to the existing form.js file in Backdrop.

Also, in D7.36 a javascript_always_use_jquery setting was introduced (change record), which was before this change here. So the equivalent commit includes tests that take that setting into consideration as well. Plus, the tests are checking if misc/form-single-submit.js is loaded on the page when a form exists, but in our case where the code lives in form.js, it will always be loaded, so the tests don't make sense or any point as they were implemented in D7.

So questions:

@herbdool
Copy link

@klonos I don't think we need to wait, and I think it makes sense that the test won't work with the way Backdrop implemented it. So I think the PR is ready for review and testing. The question I have is, what's the best way to manually test to see if double click prevention is working and if it can be disabled by setting javascript_use_double_submit_protection to TRUE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants