From fabb53f2e009b79c2c87ea7683e45b3202d4a934 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 13 Mar 2020 10:36:19 +0100
Subject: [PATCH] Attempt to fix promotions on mobile browsers

---
 client/src/components/Board.vue | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue
index 5080e846..f2fd44c3 100644
--- a/client/src/components/Board.vue
+++ b/client/src/components/Board.vue
@@ -294,7 +294,16 @@ export default {
           }
         },
         this.choices.map(m => {
-          //a "choice" is a move
+          // A "choice" is a move
+          const applyMove = (e) => {
+            e.stopPropagation();
+            this.play(m);
+            this.choices = [];
+          };
+          const onClick =
+            this.mobileBrowser
+              ? { touchend: applyMove }
+              : { mouseup: applyMove };
           return h(
             "div",
             {
@@ -316,12 +325,7 @@ export default {
                     ".svg"
                 },
                 class: { "choice-piece": true },
-                on: {
-                  click: () => {
-                    this.play(m);
-                    this.choices = [];
-                  }
-                }
+                on: onClick
               })
             ]
           );
-- 
2.44.0