2138 - Change cancel button to uploading button for CSV

This commit is contained in:
Jonathan Bobel
2025-03-26 14:49:11 -04:00
parent 7458acdab1
commit d79ece2d01
4 changed files with 36 additions and 9 deletions

View File

@@ -5,9 +5,21 @@
this.submit = () => this.$form.trigger('submit');
this.showCancelButton = () => $('.file-upload-button', this.$form).replaceWith(`
<a href="" class='usa-button usa-button--secondary'>Cancel upload</a>
`);
this.showCancelButton = () => {
$('.file-upload-button', this.$form).replaceWith(`
<button class='usa-button uploading-button' aria-disabled="true" tabindex="0">
Uploading<span class="dot-anim" aria-hidden="true"></span>
</button>
`);
// Screen reader live region
const $srStatus = $('#upload-status-live');
if ($srStatus.length) {
$srStatus.text('File is uploading');
} else {
this.$form.prepend(`<span id="upload-status-live" class="usa-sr-only" role="status" aria-live="polite">File is uploading</span>`);
}
};
this.start = function(component) {
@@ -17,7 +29,7 @@
// users see a button that looks like the others on the site.
this.$form.find('label.file-upload-button').addClass('usa-button margin-bottom-1').attr( {role: 'button', tabindex: '0'} );
// Clear the form if the user navigates back to the page
$(window).on("pageshow", () => this.$form[0].reset());