Skip to content

Commit

Permalink
Add keyboard navigation to spaces (#9625)
Browse files Browse the repository at this point in the history
* Add keyboard navigation to spaces

* Update changelog item

* Lint

* Add changelog item
  • Loading branch information
Jan authored Aug 31, 2023
1 parent 5ab08f9 commit e4fe75a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Add keyboard navigation to spaces overview

In the spaces overview it is now possible to navigate through the individual spaces
and perform actions using the keyboard

https://github.com/owncloud/web/pull/9625
https://github.com/owncloud/web/issues/9624
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { onBeforeUnmount, onMounted, unref, computed, Ref, watchEffect } from 'vue'
import { eventBus, useStore, ViewModeConstants } from 'web-pkg'
import { eventBus, QueryValue, useStore, ViewModeConstants } from 'web-pkg'
import { KeyboardActions } from 'web-pkg/src/composables/keyboardActions'
import { Resource } from 'web-client'
import { findIndex } from 'lodash-es'

export const useKeyboardTableMouseActions = (
keyActions: KeyboardActions,
viewMode: Ref<string>
viewMode: Ref<string | QueryValue>
) => {
const store = useStore()
const latestSelectedId = computed(() => store.state.Files.latestSelectedId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useStore, ViewModeConstants } from 'web-pkg'
import { QueryValue, useStore, ViewModeConstants } from 'web-pkg'
import { useScrollTo } from 'web-app-files/src/composables/scrollTo'
import { computed, Ref, ref, unref, nextTick, watchEffect } from 'vue'
import { Key, KeyboardActions, ModifierKey } from 'web-pkg/src/composables/keyboardActions'
Expand All @@ -12,7 +12,7 @@ const enum Direction {
export const useKeyboardTableNavigation = (
keyActions: KeyboardActions,
paginatedResources: Ref<Resource[]>,
viewMode: Ref<string>
viewMode: Ref<string | QueryValue>
) => {
const store = useStore()
const { scrollToResource } = useScrollTo()
Expand Down
11 changes: 11 additions & 0 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ import { sortFields as availableSortFields } from '../../helpers/ui/resourceTile
import { formatFileSize } from 'web-pkg/src'
import { useGettext } from 'vue3-gettext'
import { spaceRoleEditor, spaceRoleManager, spaceRoleViewer } from 'web-client/src/helpers/share'
import { useKeyboardActions } from 'web-pkg/src/composables/keyboardActions'
import {
useKeyboardTableNavigation,
useKeyboardTableMouseActions,
useKeyboardTableActions
} from 'web-app-files/src/composables/keyboardActions'
export default defineComponent({
components: {
Expand Down Expand Up @@ -233,6 +239,11 @@ export default defineComponent({
defaultValue: ViewModeConstants.tilesView.name
})
const keyActions = useKeyboardActions()
useKeyboardTableNavigation(keyActions, runtimeSpaces, viewMode)
useKeyboardTableMouseActions(keyActions, viewMode)
useKeyboardTableActions(keyActions)
const getManagerNames = (space: SpaceResource) => {
const allManagers = space.spaceRoles[spaceRoleManager.name]
const managers = allManagers.length > 2 ? allManagers.slice(0, 2) : allManagers
Expand Down

0 comments on commit e4fe75a

Please sign in to comment.