[Feature Proposal] Make `data-disable: true` work for remote input elements

As of today, one can create “auto-saving” forms in rails by adding relevant data-attributes to inputs such as data-remote: true and data-url="/endpoint" . It is particularly handy when building forms such as Notifications settings forms:

<%= check_box_tag :notify_upon_mention, 
                                   "1", 
                                   notifying_upon_mention?, 
                                   data: {
                                     remote: true,
                                     url: notification_settings_path,
                                     method: "post",
                                   } %> 
<%= label_tag :notify_upon_mention, "Notify me when people @mention me" %>

One might assume that adding a data-disable attribute would disable the checkbox whilst the ajax request completes (or fails) - as it would work for a classic remote form - however it is not the case.

What do you think about enabling such a feature ? Since Rails allow for remote input elements, it’d make sense to add a disable option to it don’t you think ? It’d be great for preventing double-clicks, user overflowing the server with requests, or even giving feedback back to the users about the pending request.

I’ve proposed an implementation in rails-ujs in the following PR on github: