Pages keep exactly one H1 while a side panel or Learn's completion modal is open
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
A page with a visible <h1> has two H1s in the accessibility tree while a kolibri-common SidePanelModal is open over it, because the panel renders its own <h1> and is not aria-modal. Learn's CompletionModal has the same gap over a resource page's hidden <h1>. For #4922, every page should have exactly one H1 in every state.
Complexity: Medium Target branch: develop
Context
kolibri-common/components/SidePanelModalis a focus trap withrole="presentation"and noaria-modal, so the page behind it stays in the accessibility tree. The coursesSidePanelModalisrole="dialog" aria-modal="true", so it does not have this gap.useSidePanelTitle(#15394) only drops the hidden<h1>of a page that has none of its own. A page with a visible<h1>keeps it.- Repro, Jest on the #15394 branch: render
LessonSummaryPagewith the realLessonResourceSelectionatLESSON_SELECT_RESOURCES: the DOM has the page'sexam-titleH1 and the panel'sside-panel-titleH1. - Facility's user side panels also render
<h1 class="side-panel-title">inside thisSidePanelModal. develop(vue-meta) has the same two H1s, so this is a gap in the new mechanism, not a regression.- Learn's
CompletionModalrenders an<h1>in arole="dialog"with noaria-modal. It is a fork ofKModal, so learningequality/kolibri-design-system#1312 and #1331 do not reach it. TopicsContentPagerenders avisuallyhidden<h1>frompageHeadingbehind the completion modal.- Repro, Jest on the #15474 branch (
TopicsContentPage.spec.jsharness): after the content emitsfinished, the H1s outside[aria-modal="true"]areResource in a panel - Topic in a panelandResource completed.
The Change
- A page with a visible
<h1>has one H1 while akolibri-commonSidePanelModalis open over it. - The panel keeps an accessible name.
- A learn resource page has one H1 while its completion modal is open.
Acceptance Criteria
General
- [ ] While Coach > Plan > Lessons > <lesson> > Manage resources is open, the page has one H1.
- [ ] After the panel closes, the page's own
<h1>is the only H1. - [ ] While the completion modal is open after finishing Learn > Library > <channel> > <resource>, the page has one H1.
- [ ] After the completion modal closes, the page's H1 count is what it was before it opened.
- [ ] Pages without an open side panel or completion modal are unchanged.
Accessibility and i18n
- [ ] A screen reader announces the panel's title when it opens.
- [ ] A screen reader announces "Resource completed" when the completion modal opens.
Testing
- [ ] A Jest test covers a page with a visible heading before, during and after a
SidePanelModalis open. - [ ] A Jest test covers a resource page before, during and after the completion modal is open.
References
SidePanelModal/index.vue#L3-L8:role="presentation", noaria-modal.courses/sidePanel/SidePanelModal.vue#L3-L19:role="dialog" aria-modal="true".LessonResourceSelection/index.vue#L19-L20: the panel's<h1>.CompletionModal/index.vue#L13-L35:role="dialog", noaria-modal, title<h1>.TopicsContentPage.vue#L58-L63: the page's hidden<h1>.
AI usage
Claude Code found this while reviewing the #15394 branch and drafted the issue; the two-H1 repro was run in Jest.
@rtibbles one question decides the design: does "one H1" mean one in the DOM, or one in the accessibility tree?
- A — accessibility tree (recommended): make
kolibri-commonSidePanelModalrole="dialog" aria-modal="true", labelled by its title, like the coursesSidePanelModal.- Covers all 16 consumers (coach, facility, learn, qti_viewer) in one file, and announces the title on open.
- The panel's
<h1>stays in the DOM, so a DOM count still finds two. Jest does not modelaria-modal, so the test asserts the page H1 is the only one outside the modal dialog.
- B — DOM: the panel renders
<h2>while its host has a visible<h1>, and stays labelled by it.- Every panel needs to know whether its host has a visible heading. That builds on
useSidePanelTitlein #15476, which is unmerged and coach-only, so this would wait for it and still not reach facility or learn.
- Every panel needs to know whether its host has a visible heading. That builds on
Also: should this cover every SidePanelModal consumer, or only coach's lesson and quiz resource panels?
A - for every consumer, so changing it in the base component is ideal.
Design, per the answer above:
kolibri-commonSidePanelModal's<section>becomesrole="dialog" aria-modal="true". The root staysrole="presentation".- Name: the
ariaLabelprop if given, elsearia-labelledbyto the first heading in the#headerslot. That heading gets an id if it has none, and is re-resolved when the header re-renders (e.g.SectionSidePanel'sv-ifheadings). - Learn's four metadata panels (
BookmarkPage,TopicsContentPage,LibraryPage,TopicsPage) have only chips in the header, so they pass the content title asariaLabel. - No change to any panel's heading level or to
useSidePanelTitle(#15476). - Tests:
SidePanelModalspec: dialog role,aria-modal, and name from the prop or the header heading.LessonSummaryPagespec: before, during and after Manage resources, exactly one H1 outside the modal dialog, and the dialog is named by the panel title.
Plan: A page with a visible <h1> has one H1 in the accessibility tree while a kolibri-common SidePanelModal is open over it.
- [ ] Base
SidePanelModalis a named modal dialog - [ ] Learn metadata panels pass a name
- [ ] Lesson summary keeps one H1 through Manage resources
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
LessonSummaryPage.spec.jsis created here; #15476 adds the same file, so whichever merges second combines the two.- The heading re-resolves in
onUpdated; if a panel ever renders its heading in a nested child, the name goes stale and needs aMutationObserver. - Learn's metadata panels are named by the content title alone; if the activity kind belongs in the name,
ariaLabelmust add it. - No warning for a panel with neither
ariaLabelnor a header heading; if one is wanted, it goes inSidePanelModal.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
@rtibbles Blocked — these cannot be assumed either way:
aria-modal="true"onSidePanelModalhides controls KDS mounts in#k-overlay(everyKSelectlistbox, e.g. facility Create user; theappendToOverlayclose-confirmation in lesson Manage resources) from AT that enforces it. Which way? - A: keeparia-modal; file a KDS issue for aKSelectmount target, and dropappendToOverlayfromLessonResourceSelection(outside this branch's files). - B: droparia-modalhere; the page H1 stays in the accessibility tree while a panel is open, so "one H1" needs another mechanism (e.g.inerton the page).
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
Sounds like this is blocked by KSelect's behaviour then? So we should file an issue on KDS to make KSelect behave appropriately in these circumstances - which should then block this issue.
Likely the requirement for this issue is that KSelect use newer dropdown handling that KDropdownMenu uses, for example?
@rtibbles Blocked — these cannot be assumed either way:
- Manage resources opens with focus on Close while the dialog has no name, which fails "A screen reader announces the panel's title when it opens". The panel title is
''untilSelectionIndexmounts after the channel fetch. May this branch change files outside its current set? - Yes: starttitleatdefaultTitleinLessonResourceSelection/index.vue:257andQuizResourceSelection/index.vue:564, and assert the name at focus time with the fetch still pending. - No: leave that criterion to a follow-up issue.
Written by rtibblesbot, an LLM-based coding agent.
Yes
@rtibbles Self-review did not converge on this branch, so nothing was pushed, though replies on the PR may describe these changes. The last review was clean, but no second review of the same tree confirmed it.
Reply with direction and another review round runs.
Written by rtibblesbot, an LLM-based coding agent.
Same gap in Learn's CompletionModal: a learn resource page has two H1s in the accessibility tree while it is open.
CompletionModal/index.vue#L13-L35renders<h1 id="modal-title">in arole="dialog"with noaria-modal.TopicsContentPage.vue#L58-L63renders the page'svisuallyhidden<h1>behind it.- It is a fork of
KModal, so learningequality/kolibri-design-system#1312 and #1331 do not reach it. - Repro, Jest on this branch (
TopicsContentPage.spec.jsharness): after the content emitsfinished, the H1s outside[aria-modal="true"]areResource in a panel - Topic in a panelandResource completed. - Manual: Learn > Library > <channel> > <resource>, finish it.
Written by rtibblesbot, an LLM-based coding agent.