Skip to content

Disable export buttons on form submit#11541

Merged
mekarpeles merged 2 commits intointernetarchive:masterfrom
jimchamp:disable-export-buttons-on-form-submit
Dec 9, 2025
Merged

Disable export buttons on form submit#11541
mekarpeles merged 2 commits intointernetarchive:masterfrom
jimchamp:disable-export-buttons-on-form-submit

Conversation

@jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Dec 3, 2025

Follows #11342

Disables data export buttons when the export form is submitted.

Technical

Testing

Screenshot

export_buttons_disabled_on_form_submit

Stakeholders

Copilot AI review requested due to automatic review settings December 3, 2025 00:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies the patron export button behavior by replacing complex download logic with a basic button disable on form submit. The previous implementation used fetch() to download CSVs programmatically and restore button state after completion. The new implementation simply disables the submit button when the form is submitted, allowing the native browser download mechanism to handle the export.

Key changes:

  • Simplified patron_exports.js from ~144 lines to ~26 lines by removing custom fetch-based download logic
  • Added patron-export-form CSS class to all export forms in the HTML template for easy selection
  • Updated initialization in index.js to select forms by class name and pass them to the simplified function

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
openlibrary/templates/account/import.html Added patron-export-form class to all five export form elements for JavaScript targeting
openlibrary/plugins/openlibrary/js/patron_exports.js Simplified from complex fetch-based download to basic button disable on submit
openlibrary/plugins/openlibrary/js/index.js Updated initialization to select forms by class and pass NodeList to new function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export function initPatronExportForms(elems) {
elems.forEach((form) => {
const submitButton = form.querySelector('input[type=submit]')
form.addEventListener('submit', () => {
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

Inconsistent quote style. The codebase predominantly uses single quotes for strings. Change "submit" to 'submit' for consistency.

Copilot uses AI. Check for mistakes.
@mekarpeles mekarpeles merged commit 5b1cc7e into internetarchive:master Dec 9, 2025
5 checks passed
@mekarpeles mekarpeles self-assigned this Dec 9, 2025
@jimchamp jimchamp deleted the disable-export-buttons-on-form-submit branch February 4, 2026 00:50
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