Skip to content

Commit 41802f0

Browse files
fix(files-list): fix sort icon visibility in scoped slot and add accessibility improvements
- Replace scoped &-icon with :deep() to reach slot content in Vue 3 - Set :size="24" on NcIconSvgWrapper to match Files app icon size - Simplify template to single NcIconSvgWrapper with computed isAscending - Add :title="name" to NcButton for tooltip and screen reader hint Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent dd2ba82 commit 41802f0

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

src/views/FilesList/FilesListTableHeaderButton.vue

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
'files-list__column-sort-button--size': filesSortingStore.sortingMode === 'size',
99
}]"
1010
:alignment="mode === 'size' ? 'end' : 'start-reverse'"
11+
:title="name"
1112
variant="tertiary"
1213
@click="filesSortingStore.toggleSortBy(mode)">
1314
<template #icon>
14-
<NcIconSvgWrapper :path="mdiMenuUp" v-if="filesSortingStore.sortingMode !== mode || filesSortingStore.sortingDirection === 'asc'" class="files-list__column-sort-button-icon" />
15-
<NcIconSvgWrapper :path="mdiMenuDown" v-else class="files-list__column-sort-button-icon" />
15+
<NcIconSvgWrapper
16+
:path="isAscending ? mdiMenuUp : mdiMenuDown"
17+
:size="24"
18+
class="files-list__column-sort-button-icon" />
1619
</template>
1720
<span class="files-list__column-sort-button-text">{{ name }}</span>
1821
</NcButton>
1922
</template>
2023

2124
<script>
22-
23-
2425
import NcButton from '@nextcloud/vue/components/NcButton'
2526
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
2627
import {
@@ -56,6 +57,13 @@ export default {
5657
mdiMenuUp,
5758
}
5859
},
60+
61+
computed: {
62+
isAscending() {
63+
return this.filesSortingStore.sortingMode !== this.mode
64+
|| this.filesSortingStore.sortingDirection === 'asc'
65+
},
66+
},
5967
}
6068
</script>
6169

@@ -70,22 +78,24 @@ export default {
7078
font-weight: normal;
7179
}
7280
73-
&-icon {
81+
:deep(.files-list__column-sort-button-icon) {
7482
color: var(--color-text-maxcontrast);
7583
opacity: 0;
7684
transition: opacity var(--animation-quick);
7785
inset-inline-start: -10px;
7886
}
7987
80-
&--size &-icon {
88+
&--size :deep(.files-list__column-sort-button-icon) {
8189
inset-inline-start: 10px;
8290
}
8391
84-
&--active &-icon,
85-
&:hover &-icon,
86-
&:focus &-icon,
87-
&:active &-icon {
88-
opacity: 1;
92+
&--active,
93+
&:hover,
94+
&:focus,
95+
&:active {
96+
:deep(.files-list__column-sort-button-icon) {
97+
opacity: 1;
98+
}
8999
}
90100
}
91101
</style>

0 commit comments

Comments
 (0)