diff --git a/kolibri/core/assets/src/utils/browserInfo.js b/kolibri/core/assets/src/utils/browserInfo.js index f78e728bc7..516024db0f 100644 --- a/kolibri/core/assets/src/utils/browserInfo.js +++ b/kolibri/core/assets/src/utils/browserInfo.js @@ -69,3 +69,15 @@ export const isTouchDevice = 'ontouchstart' in window || window.navigator?.maxTouchPoints > 0 || window.navigator?.msMaxTouchPoints > 0; + +function handlePointerDown(event) { + if (event.pointerType === 'mouse') { + localStorage.setItem('mouseUsed', 'true'); + isMouseUsed = true; + window.removeEventListener('pointerdown', handlePointerDown); + } +} + +window.addEventListener('pointerdown', handlePointerDown); + +export let isMouseUsed = localStorage.getItem('mouseUsed') === 'true'; diff --git a/kolibri/plugins/perseus_viewer/assets/src/views/PerseusRendererIndex.vue b/kolibri/plugins/perseus_viewer/assets/src/views/PerseusRendererIndex.vue index a50fa8821e..b9756bbdec 100644 --- a/kolibri/plugins/perseus_viewer/assets/src/views/PerseusRendererIndex.vue +++ b/kolibri/plugins/perseus_viewer/assets/src/views/PerseusRendererIndex.vue @@ -91,7 +91,7 @@ import client from 'kolibri.client'; import urls from 'kolibri.urls'; import responsiveWindowMixin from 'kolibri.coreVue.mixins.responsiveWindowMixin'; - import { isTouchDevice } from 'kolibri.utils.browserInfo'; + import { isTouchDevice, isMouseUsed } from 'kolibri.utils.browserInfo'; import scriptLoader from 'kolibri-common/utils/scriptLoader'; import perseus from '../../dist/perseus'; import icu from '../KAGlobals/icu'; @@ -144,7 +144,7 @@ return this.windowBreakpoint < 3; }, usesTouch() { - return isTouchDevice; + return isTouchDevice && !isMouseUsed; }, itemRenderData() { return {