Selaa lähdekoodia

Correct ESC keydown handling and bubbling - store "consumed" state in e.originalEvent

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
547a7d0ba3

+ 8 - 0
minify.sh

@@ -550,4 +550,12 @@ window.initSegmentMoes = function(_parent) {
             }
             return false;
         });
+};
+window.isEventConsumed = function(_e) {
+    return _e && _e.originalEvent && _e.originalEvent.stagCosumed
+};
+window.markEventAsConsumed = function(_e) {
+    if(_e && _e.originalEvent) {
+        _e.originalEvent.stagCosumed = true;
+    }
 };

+ 1 - 0
public/js/pro-suggest.js

@@ -34,6 +34,7 @@
         switch (e.which) {
             case 27:
                 suggestionsOuter.addClass('d-none');
+                markEventAsConsumed(e);
                 return false;
             case 38:
                 if (activeItem.prev().length) {

+ 1 - 0
public/js/shortcut.js

@@ -165,6 +165,7 @@
                     case 27:
                         if(!isVisible()) return;
                         consumed = !discard();
+                        if(consumed) markEventAsConsumed(e);
                         break;
                     case 38:
                         if(!isVisible()) return;

+ 2 - 1
public/js/stag-popup.js

@@ -192,9 +192,10 @@ function hasResponseError(_data) {
             .off('keydown.stag-popup-escape')
             .on('keydown.stag-popup-escape', function (e) {
                 if(e.which === 27) {
-                    if(!window.moeClosedAt || (new Date()).getTime() - window.moeClosedAt > 1000) {
+                    if(!isEventConsumed(e)) {
                         if(stagPopupsQueue.length) {
                             closeStagPopup();
+                            markEventAsConsumed(e);
                             return false;
                         }
                     }

+ 1 - 0
public/js/stag-suggest.js

@@ -74,6 +74,7 @@
             switch (e.which) {
                 case 27:
                     suggestionsOuter.addClass('d-none');
+                    markEventAsConsumed(e);
                     return false;
                 case 38:
                     if (activeItem.prev().length) {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
public/js/yemi.js


+ 1 - 0
resources/views/layouts/template.blade.php

@@ -328,6 +328,7 @@
                     switch (e.which) {
                         case 27:
                             $('.patient-search-results.suggestions-outer').addClass('d-none');
+                            markEventAsConsumed(e);
                             return false;
                         case 38:
                             if (activeItem.prev().length) {

+ 1 - 0
yemi.js

@@ -1103,6 +1103,7 @@ $(document).ready(function () {
                     hideMoeFormMask();
                     visibleMoes.hide();
                     window.moeClosedAt = (new Date()).getTime();
+                    markEventAsConsumed(e);
                     return false;
                 }
             }

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä