Merge pull request #42623 from nextcloud/backport/41619/stable28

[stable28] fix(files): remove focus outline on file list item click and make the link focusable
This commit is contained in:
Grigorii K. Shartsev 2024-01-09 00:12:30 +05:00 committed by GitHub
commit 131e82e199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 15 deletions

View file

@ -37,12 +37,13 @@
@keyup.esc="stopRenaming" />
</form>
<a v-else
<component :is="linkTo.is"
v-else
ref="basename"
:aria-hidden="isRenaming"
class="files-list__row-name-link"
data-cy-files-list-row-name-link
v-bind="linkTo"
v-bind="linkTo.params"
@click="$emit('click', $event)">
<!-- File name -->
<span class="files-list__row-name-text">
@ -50,7 +51,7 @@
<span class="files-list__row-name-" v-text="displayName" />
<span class="files-list__row-name-ext" v-text="extension" />
</span>
</a>
</component>
</template>
<script lang="ts">
@ -139,8 +140,10 @@ export default Vue.extend({
linkTo() {
if (this.source.attributes.failed) {
return {
title: t('files', 'This node is unavailable'),
is: 'span',
params: {
title: t('files', 'This node is unavailable'),
},
}
}
@ -149,16 +152,24 @@ export default Vue.extend({
const action = enabledDefaultActions[0]
const displayName = action.displayName([this.source], this.currentView)
return {
title: displayName,
role: 'button',
is: 'a',
params: {
title: displayName,
role: 'button',
tabindex: '0',
},
}
}
if (this.source?.permissions & Permission.READ) {
return {
download: this.source.basename,
href: this.source.source,
title: t('files', 'Download file {name}', { name: this.displayName }),
is: 'a',
params: {
download: this.source.basename,
href: this.source.source,
title: t('files', 'Download file {name}', { name: this.displayName }),
tabindex: '0',
},
}
}
@ -329,7 +340,6 @@ export default Vue.extend({
}
},
t,
},
})

View file

@ -547,11 +547,13 @@ export default defineComponent({
}
// Keyboard indicator a11y
&:focus .files-list__row-name-text,
&:focus-visible .files-list__row-name-text {
&:focus .files-list__row-name-text {
outline: 2px solid var(--color-main-text) !important;
border-radius: 20px;
}
&:focus:not(:focus-visible) .files-list__row-name-text {
outline: none !important;
}
}
.files-list__row-name-text {

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long