Skip to content

Commit

Permalink
fix: Avoid double tap on iOS and close navigation on click
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Sep 2, 2024
1 parent 06fcf8f commit 40ac9b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/navigation/AppNavigationBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
:to="routeTo"
:undo="deleted"
:menu-placement="'auto'"
:force-display-actions="isTouchDevice"
@click="onNavigate"
@undo="unDelete">
<NcAppNavigationIconBullet slot="icon" :color="board.color" />

Expand Down Expand Up @@ -152,6 +154,9 @@ import CloseIcon from 'vue-material-design-icons/Close.vue'
import CheckIcon from 'vue-material-design-icons/Check.vue'
import { loadState } from '@nextcloud/initial-state'
import { emit } from '@nextcloud/event-bus'
import isTouchDevice from '../../mixins/isTouchDevice.js'
const canCreateState = loadState('deck', 'canCreate')
Expand All @@ -173,6 +178,7 @@ export default {
directives: {
ClickOutside,
},
mixins: [isTouchDevice],
inject: [
'boardApi',
],
Expand Down Expand Up @@ -336,6 +342,13 @@ export default {
actionExport() {
this.boardApi.exportBoard(this.board)
},
onNavigate() {
if (this.isTouchDevice) {
emit('toggle-navigation', {
open: false,
})
}
},
},
}
</script>
Expand Down
12 changes: 12 additions & 0 deletions src/mixins/isTouchDevice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

export default {
computed: {
isTouchDevice() {
return ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)
},
},
}

0 comments on commit 40ac9b6

Please sign in to comment.