kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Buttons styled as links ignore Space and are not exposed as buttons

Open rtibblesbot opened this issue 1 week ago • 4 comments

❌ 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-expanded attribute. An expanded one has aria-expanded="true".
  • aria-controls is section-question-panel-<index>, an id no element has.
  • axe-core reports two critical violations on each heading (.accordion-header-label): aria-allowed-attr (aria-expanded on an <a> with no href) and aria-valid-attr-value (the aria-controls id).

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

  1. As a coach, create a quiz with two sections and assign it to a class.
  2. As a learner in that class, open the quiz from Learn > Home in a window wide enough to show the question list.
  3. Tab to the second section's heading and press Space. The section stays collapsed.
  4. Press Enter. The section expands.

For "N locations":

  1. Import a resource that sits in two folders or channels, and sign in as a learner.
  2. Resize the browser to 400 px wide, open Learn > Library and search for the resource.
  3. Tab to "2 locations" on its card and press Space. The Locations dialog does not open.
  4. 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 button role.
  • [ ] The control has aria-expanded="false" when its section is collapsed and aria-expanded="true" when expanded.
  • [ ] aria-controls names the id of the element that holds the section's questions.
  • [ ] axe-core reports no aria-allowed-attr or aria-valid-attr-value violation 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 button role.
  • [ ] 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.

rtibblesbot avatar Nov 25 '26 09:11 rtibblesbot

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-expanded on the <a> with no href that KButton appearance="basic-link" renders.
  • aria-valid-attr-value: aria-controls="section-question-panel-<n>"; the section's element has id section-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.

rtibblesbot avatar Nov 25 '26 10:11 rtibblesbot

/assign

ArpitaSamanta10 avatar Nov 25 '26 13:11 ArpitaSamanta10

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.

learning-equality-bot avatar Nov 25 '26 13:11 learning-equality-bot

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:

Reproduce:

  1. Import a resource that sits in two folders or channels, and sign in as a learner.
  2. Resize the browser to 400 px wide, open Learn > Library and search for the resource.
  3. 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.x at b19ef0f009 (Kolibri Design System 5.9.0), with the real SearchResultsGrid, ResourceCard and CopiesModal at 400 px.
  • On develop at 758605b764 the 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.

rtibblesbot avatar Nov 25 '26 17:11 rtibblesbot