From f296c3d4d610e04f8c9b56dcee319b6d783a9290 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 8 Apr 2020 20:36:47 +0200 Subject: [PATCH] Fix tooltips removal on smartphone --- client/src/views/Game.vue | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 6d5a92ab..8667e9b7 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -89,7 +89,7 @@ main aria-label="Chat" ) img(src="/images/icons/chat.svg") - #actions(v-show="game.score=='*'") + #actions(v-if="game.score=='*'") button.tooltip( @click="clickDraw()" :class="{['draw-' + drawOffer]: true}" @@ -109,7 +109,7 @@ main ) img(src="/images/icons/resign.svg") button.tooltip( - v-show="game.score!='*'" + v-else @click="clickRematch()" :class="{['rematch-' + rematchOffer]: true}" :aria-label="st.tr['Rematch']" @@ -270,12 +270,6 @@ export default { .addEventListener("click", processModalClick); } ); - if ("ontouchstart" in window) { - // Disable tooltips on smartphones: - document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { - elt.classList.remove("tooltip"); - }); - } }, beforeDestroy: function() { this.cleanBeforeDestroy(); @@ -1213,6 +1207,14 @@ export default { }, game ); + if ("ontouchstart" in window) { + this.$nextTick(() => { + // Disable tooltips on smartphones: + document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { + elt.classList.remove("tooltip"); + }); + }); + } this.$refs["basegame"].re_setVariables(this.game); if (!this.gameIsLoading) { // Initial loading: @@ -1565,6 +1567,15 @@ export default { // In corr games, callback to change page only after score is set: gameOver: function(score, scoreMsg, callback) { this.game.score = score; + if ("ontouchstart" in window) { + this.$nextTick(() => { + // Disable tooltips on smartphones + // (might be required for rematch button at least): + document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { + elt.classList.remove("tooltip"); + }); + }); + } if (!scoreMsg) scoreMsg = getScoreMessage(score); this.game.scoreMsg = scoreMsg; document.getElementById("modalRules").checked = false; -- 2.44.0