Просмотр исходного кода

fix: close popup on Esc unless in menu/input

one Esc didn't close the popup when a script was hovered (regressed in b7517217)
tophf 4 лет назад
Родитель
Сommit
2f8a6bddb3
1 измененных файлов с 5 добавлено и 11 удалено
  1. 5 11
      src/popup/views/app.vue

+ 5 - 11
src/popup/views/app.vue

@@ -479,20 +479,14 @@ export default {
     this.disposeList = [
       keyboardService.register('escape', () => {
         const item = this.activeExtras;
-        this.toggleExtras(null);
-        this.focus(item);
-      }, {
-        condition: 'activeExtras',
-      }),
-      keyboardService.register('escape', () => {
-        const { body, activeElement } = document;
-        if (activeElement !== body && body.contains(activeElement)) {
-          activeElement.blur();
+        if (item) {
+          this.toggleExtras(null);
+          this.focus(item);
+        } else if (document.activeElement?.value) {
+          document.activeElement.blur();
         } else {
           window.close();
         }
-      }, {
-        condition: '!activeExtras',
       }),
       keyboardService.register('up', () => {
         this.navigate('u');