Skip to content

Commit 2b22602

Browse files
fix(a11y): add linkAriaLabel, aria-hidden avatar and chip labels to Signer
- Add signerLinkAriaLabel computed to NcListItem so screen readers announce 'Edit signer {name}' or 'Signer {name} (already signed)' - Add aria-hidden to NcAvatar to prevent initials leaking into the accessible name (already conveyed by linkAriaLabel) - Add aria-label to identification method and status NcChips - Add sr-only span for disabled tooltip text - Add aria-disabled to the list item when signer or method is disabled Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 3ea22a3 commit 2b22602

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

src/components/Signers/Signer.vue

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,31 @@
55
<template>
66
<NcListItem ref="listItem"
77
:name="signerName"
8+
:link-aria-label="signerLinkAriaLabel"
89
:counter-number="counterNumber"
910
:counter-type="counterType"
1011
:force-display-actions="true"
1112
:class="signerClass"
1213
:title="disabledTooltip"
14+
:aria-disabled="isMethodDisabled || signer.signed ? true : undefined"
1315
@click="signerClickAction">
1416
<template #icon>
15-
<NcAvatar :size="44" :display-name="signer.displayName" />
17+
<NcAvatar :size="44" :display-name="signer.displayName" aria-hidden="true" />
1618
</template>
1719
<template #subname>
1820
<div class="signer-subname">
1921
<NcChip v-for="method in identifyMethodsNames"
2022
:key="method"
2123
:text="method"
24+
:aria-label="t('libresign', 'Identification method: {method}', { method })"
2225
:no-close="true" />
2326
<NcChip :text="signer.statusText"
2427
:variant="chipType"
2528
:icon-path="statusIconPath"
29+
:aria-label="t('libresign', 'Signer status: {status}', { status: signer.statusText })"
2630
:no-close="true"
2731
class="signer-status-chip" />
32+
<span v-if="disabledTooltip" class="sr-only">{{ disabledTooltip }}</span>
2833
</div>
2934
</template>
3035
<template #extra>
@@ -187,6 +192,14 @@ export default {
187192
return 'secondary'
188193
}
189194
},
195+
signerLinkAriaLabel() {
196+
if (this.signer.signed) {
197+
// TRANSLATORS Accessible label for a signed signer list item. {name} is the signer's display name.
198+
return t('libresign', 'Signer {name} (already signed)', { name: this.signerName })
199+
}
200+
// TRANSLATORS Accessible label for a signer list item. {name} is the signer's display name.
201+
return t('libresign', 'Edit signer {name}', { name: this.signerName })
202+
},
190203
statusIconPath() {
191204
switch (this.signer.status) {
192205
case SIGN_REQUEST_STATUS.SIGNED:
@@ -263,6 +276,17 @@ export default {
263276
opacity: 1;
264277
}
265278
}
279+
.sr-only {
280+
position: absolute;
281+
width: 1px;
282+
height: 1px;
283+
padding: 0;
284+
margin: -1px;
285+
overflow: hidden;
286+
clip: rect(0, 0, 0, 0);
287+
white-space: nowrap;
288+
border: 0;
289+
}
266290
.signer-signed .drag-handle {
267291
cursor: not-allowed;
268292
opacity: 0.3;

0 commit comments

Comments
 (0)