From 210af59e4b1235e8273dd81258c04ce0f2642d0e Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sun, 22 Nov 2026 21:40:39 +0100 Subject: [PATCH 1/2] fix(a11y): reference only rendered elements from answer inputs Short and long answers, colors, dates and file uploads pointed their input to the question title and description by id in the editor as well, where those are text fields without that id, so the references led nowhere. They now reference the title and description only where these are shown, in the form itself. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger --- playwright/e2e/a11y-question-inputs.spec.ts | 24 +++++++++++++++++++++ src/components/Questions/QuestionColor.vue | 4 ++-- src/components/Questions/QuestionDate.vue | 4 ++-- src/components/Questions/QuestionFile.vue | 6 ++++-- src/components/Questions/QuestionLong.vue | 6 ++++-- src/components/Questions/QuestionShort.vue | 6 ++++-- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/playwright/e2e/a11y-question-inputs.spec.ts b/playwright/e2e/a11y-question-inputs.spec.ts index c32bc14f1..7da67b10f 100644 --- a/playwright/e2e/a11y-question-inputs.spec.ts +++ b/playwright/e2e/a11y-question-inputs.spec.ts @@ -36,6 +36,10 @@ test.describe('Accessibility: aria attributes on question inputs', () => { 'Description of question number 1', ) + const answer = questions[0].section.locator('.question__content input') + await expect(answer).not.toHaveAttribute('aria-labelledby') + await expect(answer).not.toHaveAttribute('aria-describedby') + await topBar.toggleView(FormsView.View) const question = page.getByRole('listitem', { name: /Question number 1/ }) @@ -110,6 +114,10 @@ test.describe('Accessibility: aria attributes on question inputs', () => { await questions[0].fillTitle('My long question') await questions[0].fillDescription('Please elaborate') + const answer = questions[0].section.locator('.question__content textarea') + await expect(answer).not.toHaveAttribute('aria-labelledby') + await expect(answer).not.toHaveAttribute('aria-describedby') + await topBar.toggleView(FormsView.View) const question = page.getByRole('listitem', { name: /Question number 1/ }) @@ -170,6 +178,12 @@ test.describe('Accessibility: aria attributes on question inputs', () => { await questions[0].fillTitle('My date question') await questions[0].fillDescription('Pick a date') + const answer = questions[0].section.locator( + '.question__content[role="group"]', + ) + await expect(answer).not.toHaveAttribute('aria-labelledby') + await expect(answer).not.toHaveAttribute('aria-describedby') + await topBar.toggleView(FormsView.View) const question = page.getByRole('listitem', { name: /Question number 1/ }) @@ -241,6 +255,10 @@ test.describe('Accessibility: aria attributes on question inputs', () => { await questions[0].fillTitle('My file question') await questions[0].fillDescription('Upload your file') + const answer = questions[0].section.locator('.question__input-wrapper') + await expect(answer).not.toHaveAttribute('aria-labelledby') + await expect(answer).not.toHaveAttribute('aria-describedby') + await topBar.toggleView(FormsView.View) const question = page.getByRole('listitem', { name: /Question number 1/ }) @@ -290,6 +308,12 @@ test.describe('Accessibility: aria attributes on question inputs', () => { await questions[0].fillTitle('My color question') await questions[0].fillDescription('Pick a color') + const answer = questions[0].section.locator( + '.question__content[role="group"]', + ) + await expect(answer).not.toHaveAttribute('aria-labelledby') + await expect(answer).not.toHaveAttribute('aria-describedby') + await topBar.toggleView(FormsView.View) const question = page.getByRole('listitem', { name: /Question number 1/ }) diff --git a/src/components/Questions/QuestionColor.vue b/src/components/Questions/QuestionColor.vue index 5b96a86c9..01f5c9876 100644 --- a/src/components/Questions/QuestionColor.vue +++ b/src/components/Questions/QuestionColor.vue @@ -14,8 +14,8 @@
+ :aria-labelledby="readOnly ? titleId : undefined" + :aria-describedby="readOnly && description ? descriptionId : undefined"> + :aria-labelledby="readOnly ? titleId : undefined" + :aria-describedby="readOnly && description ? descriptionId : undefined">