From 311dccfa0c5a39417a18eb42136f40d967d0c0f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Tue, 22 Mar 2022 11:13:36 +0100
Subject: [PATCH] toggle dropdown method only if dropdown open, avoiding
 keyboard opening on iOS

---
 src/components/Dropdown.vue | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/components/Dropdown.vue b/src/components/Dropdown.vue
index d658cb72..0fa9ba3d 100644
--- a/src/components/Dropdown.vue
+++ b/src/components/Dropdown.vue
@@ -125,11 +125,10 @@ export default {
 
   methods: {
     toggleDropdown(val) {
-      if (this.isOpen) {
-        this.input = ''; // * clear input field when closing dropdown
-      } else if (this.search) {
-        //* focus on input if is a search dropdown
-        this.$refs.input.focus({
+      if (this.isOpen) { //* if dropdown is open :
+        this.input = ''; // * -> clear input field when closing dropdown
+      } else if (this.search) { //* if dropdown is closed is a search dropdown:
+        this.$refs.input.focus({ //*  -> focus on input field
           preventScroll: true,
         });
       } else if (this.clearable && val.target && this.selected) {
@@ -172,8 +171,9 @@ export default {
     },
 
     clickOutsideDropdown(e) {
-      if (!e.target.closest(`#custom-dropdown${this.identifier}`))
+      if (!e.target.closest(`#custom-dropdown${this.identifier}`) && this.isOpen) {
         this.toggleDropdown(false);
+      }
     },
   },
 };
-- 
GitLab