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

Prevent accidental double-clicking of submit buttons #914

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

KevinEtchells
Copy link
Contributor

Context

A fix for https://technologyprogramme.atlassian.net/browse/REDBOX-567?atlOrigin=eyJpIjoiNzQ1MzA4MGIwMjU4NGUzYjhlY2QxODVkYTUwMDU3NjYiLCJwIjoiaiJ9 and some associated tidy-ups.

Changes proposed in this pull request

  • Prevent accidental double-clicking when deleting files
  • Prevent accidental double-clicking when uploading files
  • Remove unused govuk-button imports

Guidance to review

  • Check double-clicking buttons on delete and upload journeys. You shouldn't get any errors or duplicate files.

Things to check

  • I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • I have run integration tests

let buttons = document.querySelectorAll(`[data-prevent-double-click="true"]`);
buttons.forEach((button) => {
button.addEventListener("click", () => {
window.setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the first timeout needed?

Copy link
Contributor Author

@KevinEtchells KevinEtchells Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemingly so. I first tried it without and it prevented anything from happening! Pushing it further down the queue seems to solve that one.

@KevinEtchells KevinEtchells merged commit 4ae2f77 into main Aug 5, 2024
10 checks passed
@KevinEtchells KevinEtchells deleted the bugfix/prevent-button-double-clicks branch August 5, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants