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

Improve accessibility on new file menu #5058

Merged
merged 1 commit into from
May 5, 2021
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
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-new-file-menu-a11y
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Improve accessibility on new file menu

We now use buttons instead of a-tags in the new file menu. Also fixed the double-focus per item when
navigating via tab.

https://github.com/owncloud/web/pull/5058
85 changes: 51 additions & 34 deletions packages/web-app-files/src/components/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,57 @@
close-on-click
:options="{ delayHide: 0 }"
>
<oc-nav>
<file-upload
:path="currentPath"
:headers="headers"
@success="onFileSuccess"
@error="onFileError"
@progress="onFileProgress"
/>
<folder-upload
v-if="!isIE11()"
:root-path="currentPath"
:path="currentPath"
:headers="headers"
@success="onFileSuccess"
@error="onFileError"
@progress="onFileProgress"
/>
<oc-nav-item
id="new-folder-btn"
icon="create_new_folder"
@click="showCreateResourceModal"
>
<translate>New folder…</translate>
</oc-nav-item>
<oc-nav-item
v-for="(newFileHandler, key) in newFileHandlers"
:key="key"
:class="'new-file-btn-' + newFileHandler.ext"
:icon="newFileHandler.icon || 'save'"
@click="showCreateResourceModal(false, newFileHandler.ext, newFileHandler.action)"
>
{{ newFileHandler.menuTitle($gettext) }}
</oc-nav-item>
</oc-nav>
<ul class="uk-list">
<li>
<file-upload
:path="currentPath"
:headers="headers"
@success="onFileSuccess"
@error="onFileError"
@progress="onFileProgress"
/>
</li>
<li v-if="checkIfBrowserSupportsFolderUpload">
<folder-upload
v-if="!isIE11()"
:root-path="currentPath"
:path="currentPath"
:headers="headers"
@success="onFileSuccess"
@error="onFileError"
@progress="onFileProgress"
/>
</li>
<li>
<div>
<oc-button
id="new-folder-btn"
appearance="raw"
class="uk-width-1-1"
justify-content="left"
@click="showCreateResourceModal"
>
<oc-icon name="create_new_folder" />
<translate>New folder…</translate>
</oc-button>
</div>
</li>
<li v-for="(newFileHandler, key) in newFileHandlers" :key="key">
<div>
<oc-button
appearance="raw"
justify-content="left"
:class="['new-file-btn-' + newFileHandler.ext, 'uk-width-1-1']"
@click="
showCreateResourceModal(false, newFileHandler.ext, newFileHandler.action)
"
>
<oc-icon :name="newFileHandler.icon || 'save'" />
<span>{{ newFileHandler.menuTitle($gettext) }}</span>
</oc-button>
</div>
</li>
</ul>
</oc-drop>
</template>
</template>
Expand Down
30 changes: 16 additions & 14 deletions packages/web-app-files/src/components/FileUpload.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<template>
<oc-nav-item icon="file_upload" @click="triggerUpload">
<span id="files-file-upload-button" v-translate>Upload File</span>
<div slot="outer-content">
<input
id="fileUploadInput"
ref="input"
type="file"
aria-labelledby="files-file-upload-button"
name="file"
multiple
@change="$_ocUpload_addFileToQue"
/>
</div>
</oc-nav-item>
<div>
<oc-button class="uk-width-1-1" justify-content="left" appearance="raw" @click="triggerUpload">
<oc-icon name="file_upload" />
<span id="files-file-upload-button" v-translate>Upload File</span>
</oc-button>
<input
id="fileUploadInput"
ref="input"
type="file"
aria-labelledby="files-file-upload-button"
name="file"
multiple
tabindex="-1"
@change="$_ocUpload_addFileToQue"
/>
</div>
</template>

<script>
Expand Down
33 changes: 18 additions & 15 deletions packages/web-app-files/src/components/FolderUpload.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<template>
<oc-nav-item v-if="checkIfBrowserSupportsFolderUpload" icon="cloud_upload" @click="triggerUpload">
<label v-translate for="folderUploadInput">Upload Folder</label>
<div slot="outer-content">
<input
id="folderUploadInput"
ref="input"
type="file"
name="folder"
webkitdirectory
mozdirectory
allowdirs
@change="$_ocUpload_addDirectoryToQue"
/>
</div>
</oc-nav-item>
<div>
<oc-button class="uk-width-1-1" justify-content="left" appearance="raw" @click="triggerUpload">
<oc-icon name="cloud_upload" />
<span id="files-folder-upload-button" v-translate>Upload Folder</span>
</oc-button>
<input
id="folderUploadInput"
ref="input"
type="file"
name="folder"
aria-labelledby="files-folder-upload-button"
webkitdirectory
mozdirectory
allowdirs
tabindex="-1"
@change="$_ocUpload_addDirectoryToQue"
/>
</div>
</template>

<script>
Expand Down