Skip to content

Commit dca646b

Browse files
authored
Merge pull request #217 from bcgov/SC3688
Add Tab Navigation to sidebar
2 parents b6d584a + 0e0c23d commit dca646b

File tree

5 files changed

+62
-15
lines changed

5 files changed

+62
-15
lines changed

frontend/src/components/bucket/BucketSidebar.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { storeToRefs } from 'pinia';
3-
import { onBeforeMount, ref, watch } from 'vue';
3+
import { onBeforeMount, onMounted, ref, watch } from 'vue';
44
55
import { Button } from '@/lib/primevue';
66
import { usePermissionStore, useUserStore } from '@/store';
@@ -9,6 +9,7 @@ import { formatDateLong } from '@/utils/formatters';
99
1010
import type { Ref } from 'vue';
1111
import type { Bucket, BucketPermission } from '@/types';
12+
import { onDialogHide } from '@/utils/utils';
1213
1314
// Props
1415
type Props = {
@@ -31,6 +32,7 @@ const managedBy: Ref<string | undefined> = ref();
3132
3233
// Actions
3334
const closeSidebarInfo = async () => {
35+
onDialogHide();
3436
emit('close-sidebar-info');
3537
};
3638
@@ -60,17 +62,30 @@ onBeforeMount(() => {
6062
load();
6163
});
6264
65+
onMounted(() => {
66+
document.getElementById('side-panel')?.focus();
67+
});
68+
6369
watch(props, () => {
6470
load();
6571
});
6672
</script>
6773

6874
<template>
69-
<div class="side-panel pl-4">
75+
<div
76+
id="side-panel"
77+
tabindex="0"
78+
class="side-panel pl-4"
79+
role="dialog"
80+
aria-modal="true"
81+
aria-labelledby="side-panel_label"
82+
aria-describedby="side-panel_desc"
83+
>
7084
<div class="flex panel-header align-items-start">
7185
<font-awesome-icon icon="fa-solid fa-circle-info" />
7286
<h1 class="mt-0 ml-3 flex-grow-1">Folder details</h1>
7387
<Button
88+
aria-label="Close"
7489
class="p-button-text pt-0"
7590
@click="closeSidebarInfo"
7691
>

frontend/src/components/bucket/BucketTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const endpointMap = new Map<string, Array<Bucket>>();
4949
5050
const showSidebarInfo = async (id: number) => {
5151
emit('show-sidebar-info', id);
52+
focusedElement.value = document.activeElement;
5253
};
5354
5455
const showBucketConfig = async (bucket: Bucket) => {
@@ -334,7 +335,6 @@ watch(getBuckets, () => {
334335
class="p-button-lg p-button-rounded p-button-text"
335336
aria-label="Folder details"
336337
@click="showSidebarInfo(node.data.bucketId)"
337-
@keyup.enter="showSidebarInfo(node.data.bucketId)"
338338
>
339339
<font-awesome-icon icon="fa-solid fa-circle-info" />
340340
</Button>

frontend/src/components/common/SyncButton.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script setup lang="ts">
2+
import { storeToRefs } from 'pinia';
23
import { ref } from 'vue';
34
45
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
56
import { Button, Dialog, useToast } from '@/lib/primevue';
6-
import { useObjectStore, useBucketStore } from '@/store';
7+
import { useObjectStore, useBucketStore, useNavStore } from '@/store';
78
import { formatDateLong } from '@/utils/formatters';
9+
import { onDialogHide } from '@/utils/utils';
810
911
import type { Ref } from 'vue';
1012
@@ -30,6 +32,7 @@ const lastSyncRequestedDate: Ref<String> = ref('');
3032
const objectStore = useObjectStore();
3133
const bucketStore = useBucketStore();
3234
const toast = useToast();
35+
const { focusedElement } = storeToRefs(useNavStore());
3336
3437
// Dialog
3538
const displaySyncDialog = ref(false);
@@ -48,6 +51,7 @@ const onSubmit = () => {
4851
};
4952
5053
const onClick = () => {
54+
focusedElement.value = document.activeElement;
5155
displaySyncDialog.value = true;
5256
if (props.bucketId) {
5357
const bucket = bucketStore.getBucket(props.bucketId);
@@ -63,11 +67,15 @@ const onClick = () => {
6367

6468
<template>
6569
<Dialog
70+
id="sync_dialog"
6671
v-model:visible="displaySyncDialog"
6772
header="Synchronize"
6873
:modal="true"
6974
:style="{ minWidth: '50vw' }"
7075
class="bcbox-info-dialog"
76+
aria-labelledby="sync_dialog_label"
77+
aria-describedby="sync_dialog_desc"
78+
@after-hide="onDialogHide"
7179
>
7280
<template #header>
7381
<font-awesome-icon
@@ -76,6 +84,7 @@ const onClick = () => {
7684
/>
7785
<span
7886
v-if="props.bucketId"
87+
id="sync_dialog_label"
7988
class="p-dialog-title"
8089
>
8190
Synchronize storage location
@@ -88,7 +97,10 @@ const onClick = () => {
8897
</span>
8998
</template>
9099

91-
<h3 class="bcbox-info-dialog-subhead">
100+
<h3
101+
id="sync_dialog_desc"
102+
class="bcbox-info-dialog-subhead"
103+
>
92104
{{ name }}
93105
</h3>
94106

@@ -103,12 +115,10 @@ const onClick = () => {
103115

104116
<ul class="mb-4 ml-1.5">
105117
<li v-if="props.bucketId">
106-
This will schedule a synchronization of the folder's
107-
contents with its source storage location (&quot;bucket&quot;)
108-
</li>
109-
<li v-else>
110-
This will schedule a synchronization of the file
118+
This will schedule a synchronization of the folder's contents with its source storage location
119+
(&quot;bucket&quot;)
111120
</li>
121+
<li v-else>This will schedule a synchronization of the file</li>
112122
<li>
113123
Use this if you are modifying it outside of BCBox, such as in another software application, and want to see
114124
those changes reflected in BCBox
@@ -135,7 +145,6 @@ const onClick = () => {
135145
class="p-button-lg p-button-text"
136146
:aria-label="labelText"
137147
@click="onClick"
138-
@keyup.enter="onClick"
139148
>
140149
<font-awesome-icon icon="fa-solid fa-sync" />
141150
</Button>

frontend/src/components/object/ObjectSidebar.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script setup lang="ts">
22
import { storeToRefs } from 'pinia';
3-
import { watch } from 'vue';
3+
import { watch, onMounted } from 'vue';
44
import { ObjectMetadata, ObjectProperties, ObjectTag } from '@/components/object';
55
import { Button } from '@/lib/primevue';
66
import { useAuthStore, useMetadataStore, useObjectStore, usePermissionStore, useTagStore } from '@/store';
77
import { Permissions, RouteNames } from '@/utils/constants';
8+
import { onDialogHide } from '@/utils/utils';
89
910
// Props
1011
type Props = {
@@ -25,11 +26,16 @@ const { getUserId } = storeToRefs(useAuthStore());
2526
2627
// Actions
2728
const closeObjectInfo = async () => {
29+
onDialogHide();
2830
emit('close-object-info');
2931
};
3032
3133
const obj = objectStore.getObject(props.objectId);
3234
35+
onMounted(() => {
36+
document.getElementById('side-panel')?.focus();
37+
});
38+
3339
watch(
3440
props,
3541
() => {
@@ -46,11 +52,24 @@ watch(
4652
</script>
4753

4854
<template>
49-
<div class="side-panel pl-4 pt-2">
55+
<div
56+
id="side-panel"
57+
tabindex="0"
58+
role="dialog"
59+
aria-modal="true"
60+
aria-labelledby="side-panel_label"
61+
class="side-panel pl-4 pt-2"
62+
>
5063
<div class="flex panel-header align-items-start">
5164
<font-awesome-icon icon="fa-solid fa-circle-info" />
52-
<h1 class="mt-0 flex-grow-1">File details</h1>
65+
<h1
66+
id="side-panel_label"
67+
class="mt-0 flex-grow-1"
68+
>
69+
File details
70+
</h1>
5371
<Button
72+
aria-label="Close"
5473
class="p-button-rounded p-button-text pt-0 mt-0"
5574
@click="closeObjectInfo"
5675
>
@@ -77,6 +96,7 @@ watch(
7796
:to="{ name: RouteNames.DETAIL_OBJECTS, query: { objectId: props.objectId } }"
7897
>
7998
<Button
99+
aria-label="View all details"
80100
label="Primary"
81101
class="p-button-outlined"
82102
@click="navigate"

frontend/src/components/object/ObjectTable.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ const onDeletedSuccess = () => {
7777
loadLazyData();
7878
};
7979
80-
const showInfo = (id: string) => emit('show-object-info', id);
80+
const showInfo = (id: string) => {
81+
emit('show-object-info', id);
82+
focusedElement.value = document.activeElement;
83+
};
8184
8285
async function showPermissions(objectId: string) {
8386
await permissionStore.fetchObjectPermissions({ objectId });

0 commit comments

Comments
 (0)