kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Closing the Locations dialog leaves keyboard focus on the page body

Open rtibblesbot opened this issue 1 week ago • 0 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

In Learn, the "N locations" link on a resource card opens the Locations dialog. After Close, document.activeElement is <body>.

KButton blurs a basic-link when it is activated (KButton.vue#L183-L190), so KModal records <body> as the element to return focus to (KModal.vue#L272, #L302).

Every page that opens the dialog passes it no element to return focus to:

The link is rendered by three cards: grid (HybridLearningContentCard/index.vue#L57-L63), list (CardList.vue#L94-L100) and small-screen (ResourceCard.vue#L45-L51).

Expected behavior

Focus returns to the "N locations" link that opened the dialog.

User-facing consequences

A keyboard or screen reader user who closes the dialog loses their place in the results: no control has focus.

Steps to reproduce

  1. Import a resource that sits in two folders or channels, and sign in as a learner.
  2. Open Learn > Library and search for the resource.
  3. Tab to "2 locations" on its card and press Enter.
  4. Select Close.
  5. Evaluate document.activeElement in the browser console: it is <body>.

Context

  • release-v0.20.x at b19ef0f009, Kolibri Design System 5.9.0
  • Reproduced in Jest (jsdom 26) with the real cards and CopiesModal: Library search results at desktop width by click and by Enter, and Home > "Continue learning on your own" at 400 px by Enter

Acceptance Criteria

  • [ ] After Close, the "N locations" link that opened the dialog has focus, on each of the three pages above, in grid, list and small-screen cards.
  • [ ] The same holds whether the link was activated by click or by Enter.
  • [ ] Enter on Close does not reopen the dialog.
  • [ ] Jest tests cover Library search results at desktop and 400 px widths, and Home > "Continue learning on your own".

AI usage

Claude Code found this while reviewing the fix for #15758, reproduced it in Jest on release-v0.20.x and drafted this report. No human has reviewed it.

rtibblesbot avatar Nov 25 '26 14:11 rtibblesbot