Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard navigation to spaces #9625

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -11,17 +11,17 @@
<oc-img
v-if="hasThumbnail"
:key="thumbnail"
v-oc-tooltip="tooltipLabelIcon"
:src="thumbnail"
class="oc-resource-thumbnail"
width="40"
height="40"
v-oc-tooltip="tooltipLabelIcon"
:aria-label="tooltipLabelIcon"
/>
<oc-resource-icon
v-else
v-oc-tooltip="tooltipLabelIcon"
:aria-label="tooltipLabelIcon"
v-else
:resource="resource"
>
<template v-if="showStatusIcon" #status>
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/components/OcTile/OcTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<span v-text="$gettext('Disabled')" />
</oc-tag>
<div
class="oc-tile-card-preview oc-flex oc-flex-middle oc-flex-center"
v-oc-tooltip="tooltipLabelIcon"
class="oc-tile-card-preview oc-flex oc-flex-middle oc-flex-center"
:aria-label="tooltipLabelIcon"
>
<div class="oc-tile-card-hover"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<span class="oc-invisible-sr" v-text="screenreaderShareExpiration" />
</div>
<oc-button
class="oc-mx-s"
id="show-more-share-options-btn"
class="oc-mx-s"
:aria-label="$gettext('Show more actions')"
appearance="raw"
>
Expand Down
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