Repository navigation
fix(a11y): use role group for ranking lists container - #3842
Conversation
|
/backport to stable5.4 |
There was a problem hiding this comment.
🟡 Changes recommended
The accessibility test asserts visibility on an empty ranked list with a zero-height bounding box, causing it to fail; assert attachment instead or rank an option first.
1 open issue
What changed in this PR
This PR addresses #3840 by correcting the ranking question’s accessibility structure in submit mode, grouping the two option lists rather than treating their wrapper as a list.
Changes:
- Changes the outer container to
role="group"while preserving its ARIA bindings. - Names both inner lists and removes the redundant ranked-item role.
- Adds a Playwright regression test for the group and named lists.
| File | Description |
|---|---|
src/components/Questions/QuestionRanking.vue |
Corrects container semantics and labels the ranking lists. |
playwright/e2e/a11y-question-inputs.spec.ts |
Adds assertions for the ranking group and its named lists. |
Review effort: Balanced
Chartman123
left a comment
There was a problem hiding this comment.
Looks good now, thanks for the fix :)
Please squash the two commits into one, else the automatic backport might fail.
The submit-mode ranking question wrapped two inner lists in a container with role="list" even though it is not a list itself. Change the outer container to role="group", keep the named inner lists, and add an explicit role="list" so WebKit exposes them as lists despite missing list markers. The ranked list only gets the role while populated to avoid an empty list role. Add a Playwright regression test asserting the group, the list names and the explicit roles. Signed-off-by: yashgill-10 <yashgill-10@users.noreply.github.com>
745bffc to
42f21c2
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |

Summary
Fixes #3840.
Problem: In submit (read-only) mode, the ranking question's outer
div.question__contenthadrole="list", but its direct children are the.ranking-unrankedand.ranking-rankedsections — not list items. This violatesaria-required-children(axe): alistmust only containlistitemchildren.Root cause: The explicit
role="list"was placed on the wrapper instead of on the actual<ul>elements rendered by theTransitionGroups, and the ranked<li>elements redundantly carriedrole="listitem".Solution:
role="group"and keeps its existingaria-labelledby/aria-describedby/aria-errormessage/aria-invalidbindings.<ul>getsaria-label="Unranked options".<ul>is named viaaria-labelledby.role="listitem"from ranked<li>elements (native<li>semantics already apply).Tests: Added a Playwright case to
playwright/e2e/a11y-question-inputs.spec.tsasserting the group contains two named lists.Testing performed
prettier --check/eslinton both changed files: pass.stylelintonQuestionRanking.vue: pass.vue-tsc --noEmit: reports pre-existing errors across the codebase (e.g.QuestionShort.vue,Forms.vue,main.ts) unrelated to this template-only change; none reference the modified lines.AI disclosure
This change was prepared with AI assistance (Devin) and reviewed by the contributor; the implementation and verification steps above were actually executed.