Buttons styled as links ignore Space and are not exposed as buttons
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
The control that expands a quiz section is a KButton with appearance="basic-link", which renders an <a> with no href and no role:
- Space does nothing. Enter toggles the section.
- A collapsed section has no
aria-expandedattribute. An expanded one hasaria-expanded="true". aria-controlsissection-question-panel-<index>, an id no element has.- axe-core reports two critical violations on each heading (
.accordion-header-label):aria-allowed-attr(aria-expandedon an<a>with nohref) andaria-valid-attr-value(thearia-controlsid).
It is the same in all three section lists:
- Learner quiz question list: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/ExamPage/AnswerHistory.vue#L24-L31
- Coach quiz preview: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/coach/frontend/views/quizzes/CreateExamPage/QuestionListPreview.vue#L64-L71
- Quiz report attempt list: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/packages/kolibri-common/components/quizzes/QuizReport/AttemptLogList.vue#L82-L89
The "N locations" control on a Learn resource card, which opens the Locations dialog, is the same KButton: Enter opens the dialog, Space does nothing, and it has no role. Three cards render it:
- Small-screen card: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/cards/ResourceCard.vue#L45-L51
- List card: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/CardList.vue#L93-L100
- Grid card: https://github.com/learningequality/kolibri/blob/758605b764b04d41d5270165cab714ddd441b78a/kolibri/plugins/learn/frontend/views/HybridLearningContentCard/index.vue#L56-L62
User-facing consequences
A keyboard user who presses Space on a section heading gets no response. A screen reader user is not told the heading is a button, nor that the section is collapsed.
On a resource card, Space on "2 locations" gets no response, and a screen reader announces it with no role.
Steps to reproduce
- As a coach, create a quiz with two sections and assign it to a class.
- As a learner in that class, open the quiz from Learn > Home in a window wide enough to show the question list.
- Tab to the second section's heading and press Space. The section stays collapsed.
- Press Enter. The section expands.
For "N locations":
- Import a resource that sits in two folders or channels, and sign in as a learner.
- Resize the browser to 400 px wide, open Learn > Library and search for the resource.
- Tab to "2 locations" on its card and press Space. The Locations dialog does not open.
- Press Enter. The dialog opens.
Context
Kolibri develop at 758605b764.
"N locations" is the same on release-v0.20.x at b19ef0f009 (Kolibri Design System 5.9.0).
Acceptance Criteria
- [ ] In each of the three lists, Space and Enter both toggle a section from its heading.
- [ ] The heading's control has the
buttonrole. - [ ] The control has
aria-expanded="false"when its section is collapsed andaria-expanded="true"when expanded. - [ ]
aria-controlsnames the id of the element that holds the section's questions. - [ ] axe-core reports no
aria-allowed-attroraria-valid-attr-valueviolation on any of the three lists. - [ ] A spec for each list finds the control by role and toggles it with the keyboard.
- [ ] On each of the three cards, the "N locations" control has the
buttonrole. - [ ] Enter on "N locations" opens the Locations dialog, once.
- [ ] Space pressed and released on "N locations" opens the Locations dialog and does not scroll the page.
- [ ] A Space keyup on "N locations" whose keydown happened on another element does not open the dialog.
- [ ] Holding Enter or Space on "N locations" does not dismiss the dialog on release.
- [ ] None of these activations opens the resource, at 400 px or at desktop width.
- [ ] Jest tests cover "N locations" on the small-screen card on Library search results and on one desktop card.
AI usage
Claude Code found this while reviewing the fix for #15980 and drafted the issue. It rendered the learner list in Jest to record the tag, the attributes and the Space and Enter results, and read the other two templates.
axe-core (WCAG 2.0 AA, Chromium 159, develop at 758605b764) reports two critical violations on each section heading (.accordion-header-label) in the learner quiz question list and the quiz report attempt list:
aria-allowed-attr:aria-expandedon the<a>with nohrefthatKButton appearance="basic-link"renders.aria-valid-attr-value:aria-controls="section-question-panel-<n>"; the section's element has idsection-questions-<n>.
Reproduce: open a quiz as a learner from Learn > Home and run axe-core on the page.
Written by rtibblesbot, an LLM-based coding agent.
/assign
Hi! 👋
Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.
We really appreciate your willingness to help. 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.
The "N locations" control on Learn resource cards is the same KButton appearance="basic-link": an <a tabindex="0"> with no href and no role (KButton.vue#L1-L13). Enter opens the Locations dialog; Space does nothing.
Three cards render it, on develop and on release-v0.20.x:
- small-screen (
ResourceCard.vue#L45-L51) - list (
CardList.vue#L93-L100) - grid (
HybridLearningContentCard/index.vue#L57-L63)
Reproduce:
- Import a resource that sits in two folders or channels, and sign in as a learner.
- Resize the browser to 400 px wide, open Learn > Library and search for the resource.
- Tab to "2 locations" on its card and press Space: the Locations dialog does not open.
Evidence:
- Reproduced in Jest (jsdom 26) on
release-v0.20.xatb19ef0f009(Kolibri Design System 5.9.0), with the realSearchResultsGrid,ResourceCardandCopiesModalat 400 px. - On
developat758605b764the three templates are read, not run. - A Space keyup handler alone opens the dialog when the Space keydown happened on another element; the criteria added to the issue body cover that.
Written by rtibblesbot, an LLM-based coding agent.