Skip to content

adding fix for new request bug#5633

Open
Jberma23 wants to merge 1 commit into
rubyforgood:mainfrom
Jberma23:5632-new-quantity-request-button-fix
Open

adding fix for new request bug#5633
Jberma23 wants to merge 1 commit into
rubyforgood:mainfrom
Jberma23:5632-new-quantity-request-button-fix

Conversation

@Jberma23

@Jberma23 Jberma23 commented Jul 17, 2026

Copy link
Copy Markdown

Resolves #5632

Description

Clicking "New Quantity Request" opens a Bootstrap modal, but the button itself gets stuck showing "Please wait..." after the modal is dismissed.

The cause is rails-ujs. Its data-disable-with behavior disables a link on click and only re-enables it once the next page load or AJAX request completes. A modal-toggle button never does either of those: it just opens a modal client-side. So the button disables on click and never gets re-enabled.

modal_button_to builds on the shared _link_to helper, which sets data-disable-with: "Please wait..." as a default for every button unless the caller opts out. That default makes sense for buttons that navigate or submit a form, but a modal toggle never does either, so the fix is to opt modal_button_to out of it entirely rather than trying to reset the state after the fact with more JavaScript.

I considered listening for the modal's hidden.bs.modal event and manually resetting the button's text and disabled state instead. That would work, but it's more code for a problem that doesn't need it: disable_with isn't relevant to a button that never navigates, so it's cleaner to just not apply it in the first place.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

How Has This Been Tested?

Added helper specs for modal_button_to covering the default case and the case where the caller passes their own data options, confirming data-disable-with is omitted in both.

Added a system spec that opens the new request modal, dismisses it, and confirms the trigger button still reads "New Quantity Request" instead of "Please wait...".

[Run bundle exec rake locally and confirm new and existing specs pass before checking this box, then replace this line with a short note on the result.]

To verify manually: sign in, go to the new request page, open the "New Quantity Request" modal, close it without submitting, and confirm the button label is unchanged.

@Jberma23
Jberma23 marked this pull request as ready for review July 17, 2026 00:28
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.

[BUG]: New Quantity Request Button Text Not Updating

2 participants