Fix dialog actions on Enter master
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 1 Apr 2025 14:15:27 +0000 (16:15 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 1 Apr 2025 14:15:27 +0000 (16:15 +0200)
src/redakcja/static/js/wiki/base.js

index ad0ca83..3ee92c4 100644 (file)
             var self = this;
 
             /* bind buttons */
-            $('button[data-ui-action]', self.$elem).click(function(event) {
-                event.preventDefault();
-
+            function dataUiAction(elem) {
                 var action = $(this).attr('data-ui-action');
                 console.log("Button pressed, action: ", action);
 
                     if(action == 'cancel')
                         self.hide();
                 }
+            }
+            $('button[data-ui-action]', self.$elem).click(function(event) {
+                event.preventDefault();
+                dataUiAction(this);
+            }).on('keydown'), function(event) {
+                if (event.key == 'Enter') {
+                    event.preventDefault();
+                    dataUiAction(this);
+                }
             });
         }