diff options
author | Christopher Ng <chrng8@gmail.com> | 2024-11-08 11:38:21 -0800 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2024-12-03 16:25:34 -0800 |
commit | 5f3bd3e30d3af226121d1583352335e34a00ac16 (patch) | |
tree | 019f1ea88c28bbdb4199de3382425578762dcc29 /apps/files/src | |
parent | 967e1a894a5ba8be9e9fbd1f5f2e6158e3600806 (diff) | |
download | nextcloud-server-5f3bd3e30d3af226121d1583352335e34a00ac16.tar.gz nextcloud-server-5f3bd3e30d3af226121d1583352335e34a00ac16.zip |
feat(files): Update caption for screen readers when uploading is not possible
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 20 | ||||
-rw-r--r-- | apps/files/src/views/FilesList.vue | 21 |
2 files changed, 19 insertions, 22 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 52ba69d8b97..81c4c5ac666 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -62,7 +62,7 @@ import type { Node as NcNode } from '@nextcloud/files' import type { ComponentPublicInstance, PropType } from 'vue' import type { UserConfig } from '../types' -import { getFileListHeaders, Folder, View, getFileActions, FileType } from '@nextcloud/files' +import { getFileListHeaders, Folder, Permission, View, getFileActions, FileType } from '@nextcloud/files' import { showError } from '@nextcloud/dialogs' import { translate as t } from '@nextcloud/l10n' import { subscribe, unsubscribe } from '@nextcloud/event-bus' @@ -170,12 +170,28 @@ export default defineComponent({ return [...this.headers].sort((a, b) => a.order - b.order) }, + cantUpload() { + return this.currentFolder && (this.currentFolder.permissions & Permission.CREATE) === 0 + }, + + isQuotaExceeded() { + return this.currentFolder?.attributes?.['quota-available-bytes'] === 0 + }, + caption() { const defaultCaption = t('files', 'List of files and folders.') const viewCaption = this.currentView.caption || defaultCaption + const cantUploadCaption = this.cantUpload ? t('files', 'You don’t have permission to upload or create files here.') : null + const quotaExceededCaption = this.isQuotaExceeded ? t('files', 'You have used your space quota and cannot upload files anymore.') : null const sortableCaption = t('files', 'Column headers with buttons are sortable.') const virtualListNote = t('files', 'This list is not fully rendered for performance reasons. The files will be rendered as you navigate through the list.') - return `${viewCaption}\n${sortableCaption}\n${virtualListNote}` + return [ + viewCaption, + cantUploadCaption, + quotaExceededCaption, + sortableCaption, + virtualListNote, + ].filter(Boolean).join('\n') }, selectedNodes() { diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 9bb1cc05d81..ccf21a54f06 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -22,21 +22,8 @@ </template> </NcButton> - <!-- Disabled upload button --> - <NcButton v-if="!canUpload || isQuotaExceeded" - :aria-label="cantUploadLabel" - :title="cantUploadLabel" - class="files-list__header-upload-button--disabled" - :disabled="true" - type="secondary"> - <template #icon> - <PlusIcon :size="20" /> - </template> - {{ t('files', 'New') }} - </NcButton> - <!-- Uploader --> - <UploadPicker v-else-if="currentFolder" + <UploadPicker v-if="canUpload && !isQuotaExceeded && currentFolder" allow-folders class="files-list__header-upload-button" :content="getContent" @@ -430,12 +417,6 @@ export default defineComponent({ isQuotaExceeded() { return this.currentFolder?.attributes?.['quota-available-bytes'] === 0 }, - cantUploadLabel() { - if (this.isQuotaExceeded) { - return t('files', 'Your have used your space quota and cannot upload files anymore') - } - return t('files', 'You don’t have permission to upload or create files here') - }, /** * Check if current folder has share permissions |