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

Default disable_with on submit_tag breaks the app if the user goes back #26366

Open
robinwhittleton opened this Issue Sep 2, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@robinwhittleton

robinwhittleton commented Sep 2, 2016

Steps to reproduce

  1. Add an f.submit to your app
  2. Observe the default data-disable-with attribute
  3. Submit the form
  4. Hit the back button

Expected behavior

The submit button should be enabled.

Actual behavior

The submit button retains its disabled state due to the browser caching the state of the form.

This is a good thing in general – we want state to be retained as we want users to be able to edit their previous submission and resubmit. However with a disabled submit button the app is effectively broken from that point on until they know how to force a refresh (standard refresh doesn’t refresh form state) or can pop open web inspector and manually remove the disabled state.

While I can see the utility of this behaviour it’s absolutely user hostile to make it a default. I note that in the PR that added this (#21135) there wasn’t any discussion of the back button issue.

System configuration

Rails 5.0.0.1
Ruby 2.3.0

@maclover7

This comment has been minimized.

Show comment
Hide comment
@maclover7

maclover7 Sep 2, 2016

Member

Hi @robinwhittleton, thanks for reporting this! I think this is more of a jquery-ujs bug, than a Rails/Action View bug. Looks like there was a ticket opened at rails/jquery-ujs a few months ago (rails/jquery-ujs#357), and there was a PR that was merged in (rails/jquery-ujs/pull/385) to try and fix this bug. Would you be willing to test out this patch locally, and see if it fixes the error for you? Thanks again for opening up this issue! :)

Member

maclover7 commented Sep 2, 2016

Hi @robinwhittleton, thanks for reporting this! I think this is more of a jquery-ujs bug, than a Rails/Action View bug. Looks like there was a ticket opened at rails/jquery-ujs a few months ago (rails/jquery-ujs#357), and there was a PR that was merged in (rails/jquery-ujs/pull/385) to try and fix this bug. Would you be willing to test out this patch locally, and see if it fixes the error for you? Thanks again for opening up this issue! :)

@maclover7 maclover7 added the actionview label Sep 2, 2016

@robinwhittleton

This comment has been minimized.

Show comment
Hide comment
@robinwhittleton

robinwhittleton Sep 3, 2016

The PR you referenced was merged on the 8th Sep 2014 rather than a few months ago 🙂 This was included in jquery-ujs 1.0.2, which was then included in jquery-rails 4.0.0. My app is on jquery-rails 4.1.1, so on jquery-ujs 1.2.1. So either jquery-ujs has since broken or the patch wasn’t effective in the first place.

I’ll investigate what’s going on with jquery-ujs when I get some more time.

robinwhittleton commented Sep 3, 2016

The PR you referenced was merged on the 8th Sep 2014 rather than a few months ago 🙂 This was included in jquery-ujs 1.0.2, which was then included in jquery-rails 4.0.0. My app is on jquery-rails 4.1.1, so on jquery-ujs 1.2.1. So either jquery-ujs has since broken or the patch wasn’t effective in the first place.

I’ll investigate what’s going on with jquery-ujs when I get some more time.

@ain

This comment has been minimized.

Show comment
Hide comment
@ain

ain Mar 27, 2017

I can second @robinwhittleton's report here. Experienced the same. The patch seems to have no effect whatsoever.

ain commented Mar 27, 2017

I can second @robinwhittleton's report here. Experienced the same. The patch seems to have no effect whatsoever.

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