Skip to content

Commit cf83257

Browse files
authored
Merge pull request #13313 from owncloud/chore/OCISDEV-485/ui-improvements
chore(web-pkg): [OCISDEV-485] ui improvements
2 parents d165261 + 2c0f6ae commit cf83257

File tree

8 files changed

+28
-12
lines changed

8 files changed

+28
-12
lines changed

packages/web-pkg/src/components/BatchActions.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
class="batch-actions oc-mr-s"
1414
:shortcut-hint="false"
1515
:show-tooltip="limitedScreenSpace"
16+
:has-limited-screen-space="limitedScreenSpace"
1617
/>
1718
</oc-list>
1819
</div>

packages/web-pkg/src/components/ContextActions/ActionMenuItem.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:type="componentType"
66
v-bind="componentProps"
77
:class="[action.class, 'action-menu-item', 'oc-py-s', 'oc-px-m', 'oc-width-1-1']"
8-
:aria-label="componentProps.disabled ? action.disabledTooltip?.(actionOptions) : null"
8+
:aria-label="ariaLabel"
99
data-testid="action-handler"
1010
:size="size"
1111
justify-content="left"
@@ -68,6 +68,7 @@ interface Props {
6868
variation?: string
6969
shortcutHint?: boolean
7070
showTooltip?: boolean
71+
hasLimitedScreenSpace?: boolean
7172
}
7273
const {
7374
action,
@@ -76,7 +77,8 @@ const {
7677
appearance = 'raw',
7778
variation = 'passive',
7879
shortcutHint = true,
79-
showTooltip = false
80+
showTooltip = false,
81+
hasLimitedScreenSpace = false
8082
} = defineProps<Props>()
8183
const { $gettext } = useGettext()
8284
const configStore = useConfigStore()
@@ -96,6 +98,17 @@ const componentType = computed<string>(() => {
9698
return 'button'
9799
})
98100
101+
const ariaLabel = computed<string | null>(() => {
102+
if (componentProps.value.disabled && action.disabledTooltip) {
103+
return action.disabledTooltip(actionOptions)
104+
}
105+
106+
if (hasLimitedScreenSpace) {
107+
return action.label(actionOptions)
108+
}
109+
110+
return ''
111+
})
99112
const componentProps = computed(() => {
100113
const properties = {
101114
appearance: action.appearance || appearance,

packages/web-pkg/src/components/ContextActions/ContextActionMenu.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:appearance="appearance"
1515
:variation="variation"
1616
:action-options="actionOptions"
17+
:has-limited-screen-space="true"
1718
class="context-menu oc-files-context-action oc-px-s oc-rounded oc-menu-item-hover"
1819
/>
1920
</oc-list>

packages/web-pkg/src/components/FilesList/ResourceListItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
v-else
2020
v-oc-tooltip="tooltipLabelIcon"
2121
:aria-label="tooltipLabelIcon"
22-
:aria-hidden="tooltipLabelIcon !== null"
22+
:aria-hidden="tooltipLabelIcon === null"
2323
:resource="resource"
2424
/>
2525
</span>

packages/web-pkg/src/components/FilesList/ResourceName.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:data-test-resource-name="fullName"
77
:data-test-resource-type="type"
88
:title="htmlTitle"
9+
:aria-label="htmlTitle"
910
>
1011
<span v-if="truncateName" class="oc-text-truncate">
1112
<span class="oc-resource-basename" v-text="displayName" />

packages/web-pkg/tests/unit/components/FilesList/__snapshots__/ResourceListItem.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`OcResource > displays parent folder name default if calculated name is empty 1`] = `
4-
"<div class="oc-resource oc-text-overflow"><span class="oc-resource-icon-wrapper"><span class="oc-icon oc-icon-l oc-icon-passive oc-resource-icon oc-resource-icon-file" aria-hidden="false"><!----></span></span>
4+
"<div class="oc-resource oc-text-overflow"><span class="oc-resource-icon-wrapper"><span class="oc-icon oc-icon-l oc-icon-passive oc-resource-icon oc-resource-icon-file" aria-hidden="true"><!----></span></span>
55
<div class="oc-resource-details oc-text-overflow oc-pl-s"><button target="_self" type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-left oc-button-gap-undefined oc-button-passive oc-button-passive-raw oc-resource-link oc-text-overflow" draggable="false">
66
<!--v-if-->
7-
<!-- @slot Content of the button --> <span class="oc-resource-name" data-test-resource-path="example.pdf" data-test-resource-name="example.pdf" data-test-resource-type="file" title="example.pdf"><span class="oc-text-truncate"><span class="oc-resource-basename">example</span></span><span class="oc-resource-extension">.pdf</span></span>
7+
<!-- @slot Content of the button --> <span class="oc-resource-name" data-test-resource-path="example.pdf" data-test-resource-name="example.pdf" data-test-resource-type="file" title="example.pdf" aria-label="example.pdf"><span class="oc-text-truncate"><span class="oc-resource-basename">example</span></span><span class="oc-resource-extension">.pdf</span></span>
88
</button>
99
<div class="oc-resource-indicators"><span style="cursor: default;" class="parent-folder oc-text-truncate"><span class="oc-icon oc-icon-s oc-icon-passive"><!----></span> <span class="text oc-text-truncate">Example parent folder name</span></span></div>
1010
</div>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`OcResourceName > does not show the name as HTML title if the path is being displayed 1`] = `
4-
"<span class="oc-resource-name" data-test-resource-path="folder" data-test-resource-name="folder" data-test-resource-type="folder" title="folder"><span class="oc-text-truncate"><span class="oc-resource-basename">folder</span></span>
4+
"<span class="oc-resource-name" data-test-resource-path="folder" data-test-resource-name="folder" data-test-resource-type="folder" title="folder" aria-label="folder"><span class="oc-text-truncate"><span class="oc-resource-basename">folder</span></span>
55
<!--v-if--></span>"
66
`;
77

8-
exports[`OcResourceName > does not truncate a very long name when disabled 1`] = `"<span class="oc-resource-name oc-display-inline-block" data-test-resource-path="super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-name=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-type="file" title=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt"><span class="oc-resource-basename oc-text-break">.super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end</span><span class="oc-resource-extension">.txt</span></span>"`;
8+
exports[`OcResourceName > does not truncate a very long name when disabled 1`] = `"<span class="oc-resource-name oc-display-inline-block" data-test-resource-path="super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-name=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-type="file" title=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" aria-label=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt"><span class="oc-resource-basename oc-text-break">.super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end</span><span class="oc-resource-extension">.txt</span></span>"`;
99

1010
exports[`OcResourceName > doesn't add extension to hidden folder 1`] = `
11-
"<span class="oc-resource-name" data-test-resource-path=".hidden" data-test-resource-name=".hidden" data-test-resource-type="folder" title=".hidden"><span class="oc-text-truncate"><span class="oc-resource-basename">.hidden</span></span>
11+
"<span class="oc-resource-name" data-test-resource-path=".hidden" data-test-resource-name=".hidden" data-test-resource-type="folder" title=".hidden" aria-label=".hidden"><span class="oc-text-truncate"><span class="oc-resource-basename">.hidden</span></span>
1212
<!--v-if--></span>"
1313
`;
1414

1515
exports[`OcResourceName > renders folder names with dots completely in the basename 1`] = `
16-
"<span class="oc-resource-name" data-test-resource-path="folder.with.dots" data-test-resource-name="folder.with.dots" data-test-resource-type="folder" title="folder.with.dots"><span class="oc-text-truncate"><span class="oc-resource-basename">folder.with.dots</span></span>
16+
"<span class="oc-resource-name" data-test-resource-path="folder.with.dots" data-test-resource-name="folder.with.dots" data-test-resource-type="folder" title="folder.with.dots" aria-label="folder.with.dots"><span class="oc-text-truncate"><span class="oc-resource-basename">folder.with.dots</span></span>
1717
<!--v-if--></span>"
1818
`;
1919

2020
exports[`OcResourceName > shows the name as HTML title if the path is not displayed 1`] = `
21-
"<span class="oc-resource-name" data-test-resource-path="folder" data-test-resource-name="folder" data-test-resource-type="folder" title="folder"><span class="oc-text-truncate"><span class="oc-resource-basename">folder</span></span>
21+
"<span class="oc-resource-name" data-test-resource-path="folder" data-test-resource-name="folder" data-test-resource-type="folder" title="folder" aria-label="folder"><span class="oc-text-truncate"><span class="oc-resource-basename">folder</span></span>
2222
<!--v-if--></span>"
2323
`;
2424

25-
exports[`OcResourceName > truncates very long name per default 1`] = `"<span class="oc-resource-name" data-test-resource-path="super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-name=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-type="file" title=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt"><span class="oc-text-truncate"><span class="oc-resource-basename">.super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end</span></span><span class="oc-resource-extension">.txt</span></span>"`;
25+
exports[`OcResourceName > truncates very long name per default 1`] = `"<span class="oc-resource-name" data-test-resource-path="super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-name=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" data-test-resource-type="file" title=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt" aria-label=".super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end.txt"><span class="oc-text-truncate"><span class="oc-resource-basename">.super-long-file-name-which-will-be-truncated-when-exceeding-the-screen-space-while-still-preserving-the-file-extension-at-the-end</span></span><span class="oc-resource-extension">.txt</span></span>"`;

packages/web-pkg/tests/unit/components/Search/__snapshots__/ResourcePreview.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`Preview component > should render preview component 1`] = `
44
"<div class="oc-resource oc-text-overflow"><span class="oc-resource-icon-wrapper"><img src="blob:image" alt="" aria-hidden="true" loading="eager" class="oc-resource-thumbnail" width="40" height="40"></span>
55
<div class="oc-resource-details oc-text-overflow oc-pl-s"><button target="_self" type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-left oc-button-gap-undefined oc-button-passive oc-button-passive-raw oc-resource-link oc-text-overflow" draggable="false">
66
<!--v-if-->
7-
<!-- @slot Content of the button --> <span class="oc-resource-name" data-test-resource-path="/" data-test-resource-name="lorem.txt" title="lorem.txt"><span class="oc-text-truncate"><span class="oc-resource-basename">lorem.txt</span></span>
7+
<!-- @slot Content of the button --> <span class="oc-resource-name" data-test-resource-path="/" data-test-resource-name="lorem.txt" title="lorem.txt" aria-label="lorem.txt"><span class="oc-text-truncate"><span class="oc-resource-basename">lorem.txt</span></span>
88
<!--v-if--></span>
99
</button>
1010
<div class="oc-resource-indicators"><a attrs="[object Object]" style="cursor: pointer;" class="parent-folder oc-text-truncate"></a></div>

0 commit comments

Comments
 (0)