Skip to content

Commit c40010b

Browse files
authored
Merge pull request #7059 from LibreSign/backport/7058/stable33
[stable33] fix: draw signature tab accessibility
2 parents ecd5fa0 + c708c53 commit c40010b

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

playwright/e2e/sign-herself-with-drawn-signature.spec.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,23 @@ test('sign herself with drawn signature', async ({ page }) => {
8787

8888
await page.getByRole('button', { name: 'Define your signature.' }).click();
8989

90-
await page.getByRole('dialog', { name: 'Customize your signatures' }).locator('canvas').click({
90+
// The signature type chooser must use role="tab" + aria-selected, not aria-pressed toggle buttons.
91+
// Screen readers announce role="tab" as "tab, 1 of 3" which lets blind users understand the widget.
92+
// With aria-pressed buttons they only hear "toggle button, pressed" with no tab count context.
93+
const signatureDialog = page.getByRole('dialog', { name: 'Customize your signatures' })
94+
await expect(signatureDialog.getByRole('tab', { name: 'Draw' })).toBeVisible()
95+
await expect(signatureDialog.getByRole('tab', { name: 'Text' })).toBeVisible()
96+
await expect(signatureDialog.getByRole('tab', { name: 'Upload' })).toBeVisible()
97+
await expect(signatureDialog.getByRole('tab', { name: 'Draw' })).toHaveAttribute('aria-selected', 'true')
98+
99+
// Navigate to a different tab and back — verifies aria-selected updates correctly
100+
await signatureDialog.getByRole('tab', { name: 'Text' }).click()
101+
await expect(signatureDialog.getByRole('tab', { name: 'Text' })).toHaveAttribute('aria-selected', 'true')
102+
await expect(signatureDialog.getByRole('tab', { name: 'Draw' })).toHaveAttribute('aria-selected', 'false')
103+
await signatureDialog.getByRole('tab', { name: 'Draw' }).click()
104+
await expect(signatureDialog.getByRole('tab', { name: 'Draw' })).toHaveAttribute('aria-selected', 'true')
105+
106+
await signatureDialog.locator('canvas').click({
91107
position: {
92108
x: 156,
93109
y: 132

src/components/Draw/Draw.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
<NcButton
1313
v-for="tab in availableTabs"
1414
:key="tab.id"
15+
role="tab"
1516
class="draw-signature__tab"
1617
:class="{ 'draw-signature__tab--active': activeTab === tab.id }"
1718
variant="tertiary"
18-
:aria-pressed="activeTab === tab.id"
19+
:aria-selected="activeTab === tab.id"
1920
@click="activeTab = tab.id">
2021
<NcIconSvgWrapper :path="tab.icon" :size="18" />
2122
<span class="draw-signature__tab-label">{{ tab.label }}</span>

0 commit comments

Comments
 (0)