Closing the Locations dialog leaves keyboard focus on the page body
❌ 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:
- Library search results, and search within a channel or folder (
SearchResultsGrid.vue#L46) - Library's "Recent" list (
ResumableContentGrid.vue#L36) - Home > "Continue learning on your own" (
ContinueLearning.vue#L36)
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
- Import a resource that sits in two folders or channels, and sign in as a learner.
- Open Learn > Library and search for the resource.
- Tab to "2 locations" on its card and press Enter.
- Select Close.
- Evaluate
document.activeElementin the browser console: it is<body>.
Context
release-v0.20.xatb19ef0f009, 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.