From 45cc4f5c01f1e5f439f92fd37fc890eab44e6142 Mon Sep 17 00:00:00 2001 From: Lily2point0 Date: Thu, 18 May 2017 17:40:04 +0100 Subject: [PATCH] disable input when swiping through clues --- src/js/oCrossword.js | 19 ++++++++++++------- src/scss/_base.scss | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/js/oCrossword.js b/src/js/oCrossword.js index bd93975..a5d3127 100644 --- a/src/js/oCrossword.js +++ b/src/js/oCrossword.js @@ -406,7 +406,7 @@ OCrossword.prototype.assemble = function assemble() { magicInput.style.top = magicInputTargetEl.offsetTop + 'px'; magicInput.focus(); magicInput.select(); - + debounce(function(){ magicInput.focus(); magicInput.select(); @@ -581,6 +581,7 @@ OCrossword.prototype.assemble = function assemble() { const onTap = function onTap(e) { let target; let clueDetails; + let isNavigation = false; blockHighlight = false; if (e.target.nodeName === 'TD' || e.target.nodeName === 'INPUT') { @@ -591,6 +592,7 @@ OCrossword.prototype.assemble = function assemble() { if(e.target.nodeName === 'A') { defEl = navigateClues(e); + isNavigation = true; } else { defEl = (e.target.nodeName === 'SPAN')?e.target.parentElement:e.target; } @@ -660,12 +662,15 @@ OCrossword.prototype.assemble = function assemble() { currentlySelectedGridItem.direction, currentlySelectedGridItem.answerLength ); - takeInput(cell, getGridCellsByNumber( - gridEl, - currentlySelectedGridItem.number, - currentlySelectedGridItem.direction, - currentlySelectedGridItem.answerLength - )); + + if(!isNavigation) { + takeInput(cell, getGridCellsByNumber( + gridEl, + currentlySelectedGridItem.number, + currentlySelectedGridItem.direction, + currentlySelectedGridItem.answerLength + )); + } } }.bind(this); diff --git a/src/scss/_base.scss b/src/scss/_base.scss index 0873c6a..a573383 100644 --- a/src/scss/_base.scss +++ b/src/scss/_base.scss @@ -117,6 +117,7 @@ background-repeat: no-repeat; background-size: cover; margin-top: 8px; + user-select: none; } &.o-crossword-clue-nav-next {