changeset b2b479747f05 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset&node=b2b479747f05
description:
        Use data instead of disabled prop when clicking on button

        The action may actually disable the button.
        (grafted from dfaac32524e24107a4ec54cc6aecb1976c33909a)
diffstat:

 src/tab.js |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 4ce47ad152a0 -r b2b479747f05 src/tab.js
--- a/src/tab.js        Sat Mar 19 15:05:21 2022 +0100
+++ b/src/tab.js        Sat Mar 26 12:59:43 2022 +0100
@@ -245,10 +245,16 @@
                 this.buttons[item.id].click(item, function(event) {
                     var item = event.data;
                     var button = this.buttons[item.id];
-                    button.prop('disabled', true);
+                    // Use data instead of disabled prop because the action may
+                    // actually disable the button.
+                    if (button.data('disabled')) {
+                        event.preventDefault();
+                        return;
+                    }
+                    button.data('disabled', true);
                     (this[item.id](this) || jQuery.when())
                         .always(function() {
-                            button.prop('disabled', false);
+                            button.data('disabled', false);
                         });
                 }.bind(this));
             };

Reply via email to