kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Pages with a visible H1 keep exactly one H1 while loading

Open rtibblesbot opened this issue 2 months ago • 1 comments

❌ 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 that registers hasVisibleHeading: true has no H1 while its content is loading, because the visible <h1> renders only after load and the core suppresses the hidden one. For #4922, every page should have exactly one H1 at all times.

Complexity: Medium Target branch: develop

Context

  • usePageTitle takes hasVisibleHeading once, at registration. AppBarPage and ImmersivePage then render no hidden <h1>.
  • Many Coach pages render their <h1> behind v-if="!pageLoading" or v-if="!loading", e.g. CourseSummaryPage, UnitDetailPage, CoachImmersivePage content.
  • Repro: Jest-render CoachImmersivePage :loading="true" inside a component registering { hasVisibleHeading: true }: 0 H1s. With loading=false: 1.
  • develop (vue-meta) rendered no hidden H1 at all, so this is a gap in the new mechanism, not a regression.

The Change

  • A page with a visible <h1> has exactly one H1 in every state, including while loading.
  • The core decides when the hidden <h1> stands in, so pages need no loading-specific code.

Acceptance Criteria

General

  • [ ] While Coach > Plan > Courses > <course> is loading, the page has one H1; after load it still has one.
  • [ ] Pages without a registered hasVisibleHeading are unchanged.

Testing

  • [ ] A Jest test covers a page with a visible heading in its loading and loaded states.

References

AI usage

Claude Code found this while reviewing the #15394 branch and drafted the issue; the loading-state repro was run in Jest.

rtibblesbot avatar Oct 02 '26 13:10 rtibblesbot

Plan: A page registering hasVisibleHeading: true has exactly one H1 in every state, including while loading (#15467).

  • [ ] Shells render the hidden H1 until the page's own H1 renders
  • [ ] Coach course page loading state
  • [ ] Self-review the produced code

Assumptions — the issue did not settle these; say so if one is wrong.

  • Coach course-page AC waits on #15476 registering CourseSummaryPage; if this merges first, the live check moves to that PR.
  • Unflagged pages with their own H1 keep two H1s, per "unchanged"; if one H1 is wanted there too, detection applies to all registrations.
  • An H1 counts only inside the shell's #main; a page H1 rendered elsewhere (teleported panel) would leave the hidden one in place.
  • Focus on the hidden H1 is lost when it unmounts after load; #15398 (PR #15485) owns refocusing, else it needs a hand-off here.

@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

rtibblesbot avatar Oct 03 '26 17:10 rtibblesbot