Skip to content

Commit 97c8e9e

Browse files
committed
♿️(frontend) make doc search result labels uniquely identifiable
Include each doc's relative update date in `SimpleDocItem` aria-label.
1 parent 426a721 commit 97c8e9e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

  • src/frontend/apps/impress/src/features/docs/doc-management/components

src/frontend/apps/impress/src/features/docs/doc-management/components/SimpleDocItem.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export const SimpleDocItem = ({
3939
const { untitledDocument } = useTrans();
4040
const { isChild } = useDocUtils(doc);
4141
const { relativeDate } = useDate();
42+
const docTitle = doc.title || untitledDocument;
43+
const docRelativeUpdate = relativeDate(doc.updated_at);
44+
const itemAriaLabel = `${t('Open document {{title}}', { title: docTitle })}. ${t(
45+
'Last update: {{update}}',
46+
{
47+
update: docRelativeUpdate,
48+
},
49+
)}`;
4250

4351
return (
4452
<Box
@@ -48,7 +56,7 @@ export const SimpleDocItem = ({
4856
$width="100%"
4957
className="--docs--simple-doc-item"
5058
role="presentation"
51-
aria-label={`${t('Open document {{title}}', { title: doc.title || untitledDocument })}`}
59+
aria-label={itemAriaLabel}
5260
>
5361
<Box
5462
$direction="row"
@@ -90,7 +98,7 @@ export const SimpleDocItem = ({
9098
$css={ItemTextCss}
9199
data-testid="doc-title"
92100
>
93-
{doc.title || untitledDocument}
101+
{docTitle}
94102
</Text>
95103
{(!isDesktop || showAccesses) && (
96104
<Box
@@ -101,7 +109,7 @@ export const SimpleDocItem = ({
101109
aria-hidden="true"
102110
>
103111
<Text $size="xs" $variation="tertiary">
104-
{relativeDate(doc.updated_at)}
112+
{docRelativeUpdate}
105113
</Text>
106114
</Box>
107115
)}

0 commit comments

Comments
 (0)