Skip to content

Focus the reader on reader-first chapters, and test the map-first half - #520

Merged
Deicyde merged 3 commits into
mainfrom
fix/507-follow-ups
Oct 31, 2026
Merged

Deicyde merged 3 commits into
mainfrom
fix/507-follow-ups

Conversation

@Deicyde

@Deicyde Deicyde commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #507. It covers the review notes there that are fixes or missing tests (review): notes 2, 3, 5 and 6. Notes 1 and 4, whether navigation-only pages should open map-first, are left for Jack.

Problem

  • Focus goes to the map on chapters that open with the reader.
    • Steps, at desktop width: from a map card, search result or breadcrumb, open a shelf or context chapter (for example a hub whose statements depend on other chapters).
    • What happens: the reader opens, but focus goes to the first map card. A chapter with only shelves draws no card, so focus is dropped.
    • Why: mapRequested in applyRoute still reads ui$scopeOverview, which is true for shelves and context cards. Fix phone Back after a closed reader, and open desktop chapters with the reader #507 moved the reader default to ui$coarseOverview, but not this line.
  • An oversized chapter with no local links opens map-first on an empty map. Its structuralScopeProjection draws no cards, only the "Not on the map" shelves. The originalNodes > MAX_MAP_NODES clause still sets ui$coarseOverview, so the chapter text sits behind the 48 px handle.

Change

  • mapRequested reads ui$coarseOverview on desktop and ui$scopeOverview on phones, the same split as the reader default in setSheet. Pages made only of topic cards keep map focus, as before.
  • The oversized clause of ui$coarseOverview also needs a drawn card (overview.nodes.length).
  • Bundle: 143,596 bytes against the 145,000 limit (main's is 143,570).
  • No command, flag, JSON key or schema changes. geometry(), fit(), sceneFrame and the layout are untouched.

Tests

  • tests/test_integrated_reader_first_browser.py (WebKit, 1440×900):
    • a map-card arrival at the hub and shelf chapters focuses .bp-reading-body h1 (the test waits up to 10 s, since focus follows the reader's math pass);
    • a new 121-statement chapter of linked chains keeps the overview class, a reader of 64 px or less, and a scale of at least 0.9 after four Zoom out clicks.
  • tests/test_dag_viewer_browser.py: the flat 1,000-statement chapter opens without the overview class and with a reader at least 340 px wide. Its old check, to_contain_text, passed while the reader was collapsed.
  • tests/test_integrated_reader_focus.py: a Node case for both halves of the focus rule. On a shelf scope with mapFirst, the desktop reader opens and takes focus, and the phone keeps the reader closed and focuses the map.
  • tests/test_scoped_overview_controls.py: a Node case where an authored-area overview stops zoom-out at 0.9 and, with the areas removed, the shelf overview does not.
  • tests/test_integrated_phone_back_browser.py: before Back, the test also reads the cards each map draws on screen and asserts that they share none. Cards are drawn only near the viewport, so this complements the index check rather than replacing it.
  • The tests catch the bugs. With one change undone at a time, the targeted tests fail only where expected:
    • focus line reverted to ui$scopeOverview: both WebKit focus cases fail (run 41165282694), and so does the desktop half of the Node case; using ui$coarseOverview on phones too fails its phone half (both Node checks run locally);
    • drawn-card condition removed: the flat chapter keeps the overview class (run 41163077080);
    • oversized clause removed: the 121-statement chapter loses it (run 41163077017).
  • The last two runs are from the first version of this commit, 9d64e81; the review changes after them touched only wording, a comment and the focus tests.
  • Full suite on scratch CI: every job passes at fa438fd (run 41165283286), as at 9d64e81 (run 41163077500).

Landing

Posted by PR swarm: 320-329 Reviewer

A map-card, search or breadcrumb arrival at a desktop shelf or context
chapter opened the reader but focused the first map card, because
mapRequested still read ui$scopeOverview. On desktop it now reads
ui$coarseOverview, so focus goes to the reading heading; phones keep
ui$scopeOverview. Topic-card pages keep map focus.

A chapter over 120 nodes with no local links drew no cards but still set
ui$coarseOverview, so it opened map-first on an empty map with the reader
collapsed. The oversized clause now also needs a drawn card.

Tests: the map-card arrival focuses the reading heading at the hub and
shelf chapters; a Node case checks the desktop and phone halves of the
focus rule; a 121-statement linked chapter keeps the overview class, the
collapsed reader and the 0.9 floor; the flat 1,000-statement chapter
opens with a reader at least 340 px wide; a Node case checks that only a
coarse overview stops zoom-out at 0.9; and the phone Back test also
checks that the two maps draw no shared card on screen.
# Conflicts:
#	autoform_cli/assets/blueprint-explorer.min.js
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 31, 2026
@Deicyde
Deicyde merged commit 4ebaa68 into main Oct 31, 2026
1 check passed
@Deicyde
Deicyde deleted the fix/507-follow-ups branch October 31, 2026 04:22
@Deicyde

Deicyde commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Review at ba1c880: nothing blocks; ready to merge. This is the authoring session's review. A separate agent that did not write the change reviewed the commit's first version, 9d64e81, before this PR opened, and its fixes are in. It found one blocker: the CHANGELOG said every reader-first arrival focuses the heading, but pages made only of topic cards keep map focus, as || mapAllowed && topicCards intends. The entry now names shelf and context chapters and extends #507's entry. Its notes led to the Node case for the phone half of the focus rule, the 10 s focus wait, and accurate wording for the phone Back card check. A Node probe of the production structuralScopeProjection and boundaryContextProjection over six oversized cases found overview.nodes.length is 0 exactly when the map draws no card: with 0 to 3 boundaries, and with only an "External scopes" group. Phones read the same expression as before. The mutant runs in the body show that each change has a test that fails without it. CI at ba1c880 passes 9/9 (run 41168245230), and the head merges cleanly with current main.

Posted by PR swarm: 320-329 Reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant