Repository navigation
Conversation
In a book that scrolls, the reader navigated for a scroll of the user's once the scroll was over, half a second after its last move. Until then the current navigation was from before the scroll. A page turn or a "next spine item" made in that time started from where the scroll began, so the book moved back. The scroll now navigates at each move. It still navigates to where the element is as a layout starts: a browser reports a move a frame or more after it happens. The reading position still moves once the scroll is over. Fixes #779.
`navigation$` and `navigationRequest$` emit at each move of a scroll of the user's, and pagination is not settled until the scroll is over. The guides said that a navigation made during a scroll ends it: only one that the scroll did not make does.
With a navigation at each move, the navigation says where the user is. The end of a scroll no longer works that out again. When the page turn mode changes during a scroll, the scroll only ends: the release of the lock lands the navigation of the last move. It navigated once more, by the rule for pages that turn, and landed on the next page from a quarter of a page scrolled past. When nothing has moved for a while, the scroll still navigates to where the element rests: a scroll of less than a pixel is not told as a move. `scrollPositionKnownToReader$` had this one reader, and goes.
When a spine item changes height where it is, a book that scrolls keeps its distance to the top of the item or to its bottom, by the direction of the navigation. The direction was guessed from the position of the navigation before. With a navigation at each move, a last move of one pixel the other way turned it round, and the book jumped by as much as the item grew. In a book that scrolls, the direction now says by which end the reader came into the spine item: forward from an item before it, backward from one after it. A position in the same spine item keeps the direction.
…yout Two cases hold the direction of a scroll: the user comes into a spine item by one end, the last move goes a pixel the other way, and the item grows. One case holds a move that the user makes while a layout pass is in progress: the book ends where that move took it. The renderer of set sizes can hold the layout of one item.
The scroll makes one when the scrolling has stopped for half a second. A change of page turn mode or another navigation ends it with none.
…layout A navigation asked for before the book is first laid out replaces the one the reader opens with. With a navigation at each move, a scroll of the user's during that first layout did so too, and the book never went to its target. A navigation that follows a scroll no longer replaces it: the book is not laid out yet, so the scroll took the user to no place in it.
One case for each way a position gets its direction: inside the spine item of the navigation before, into another spine item, over several, in none, and where the pages turn, where the rule did not change. BREAKING CHANGE: `reader.navigation.scrollNavigationController.scrollPositionKnownToReader$` is removed. The end of a scroll of the user's was its one reader and no longer needs it. Commit d8afac2 removed it without this note.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50513bdfe7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… out A scroll that began before the first layout kept the lock after the reader opened at its target. Its last navigation, half a second after its last move, then replaced that target. A place in a spine item that was not loaded yet was lost: the reader finds it from the target. The user's scroll now begins at the first move after the spine items are first laid out. The navigator no longer needs a rule of its own for a scroll made before it opens.
Why
In a book that scrolls, a page turn or a "next spine item" made right after a scroll moves the book back. The user scrolls from the first page to the third one and presses "next". The reader shows the second page.
The reader navigated for a scroll only once the scroll was over, half a second after its last move. Until then, a navigation that starts from where the reader is started from where the scroll began.
Fixes #779. It applies decision 3, option a, of #807: the scroll navigates at each move.
Reviewer guide
Changes
UserScrollNavigationmakes a navigation at each move that the browser reports.Other changes
scrollPositionKnownToReader$is removed from the scroll controller: its one reader is gone.core-api/navigation,learn/navigation,learn/page-turn-modeandlearn/pagination.Public API
Breaking: this needs a semver major. One name is removed:
reader.navigation.scrollNavigationController.scrollPositionKnownToReader$. It was released in v44. No docs page names it. One commit of the branch carries theBREAKING CHANGEnote that the release reads.Four documented behaviours change during a scroll of the user's, in a book that scrolls:
reader.navigation.navigation$andnavigationRequest$emit at each move.reader.navigation.getNavigation()andposition$follow the scroll.reader.pagination.state.isSettledisfalsefrom the first move until the scroll is over."user"navigation. The reader lands the navigation of the last move, as a"restoration".reader.navigation.readingPosition$does not change: it moves once the scroll is over.Validation
apps/docs, or checked that the documentation still holdsDetails
What a scroll event costs
Script time for each scroll event in Chromium. The test makes one scroll event for each frame during 4 s, and each one is a move:
The scroll itself
The same wheel input, 60 moves of 100 px, with and without a navigation at each move, in Chromium, Firefox and WebKit:
The end of a scroll
With a navigation at each move, the navigation says where the user is. The end of a scroll no longer finds that place again:
The navigation made at a mode change was resolved by the rule for pages that turn. From a quarter of a page scrolled past, that rule took the next page. This bug is on
developtoo.The direction of a scroll
A spine item can change height where it is. A book that scrolls then keeps its distance to the top of the item or to its bottom. The direction of the navigation decides which one. It was guessed from the position of the navigation before.
With a navigation at each move, that position is the move before. A last move of one pixel the other way then turned the direction round, and the book jumped by as much as the item grew. The direction now says by which end the reader came into the spine item, and a move inside the item keeps it.
Why not read the scroll element when a page turn is asked for
That design adds no work to a scroll event. Every piece of code that reads the current navigation then has to read the scroll element too.
navigation$andposition$stay on the place from before the scroll. #777 (load while the user scrolls) needs the navigation to follow the scroll.Evidence
develop, 12 new or changed cases fail, each on the assertion it was written for.Limits
getBoundingClientRect. Chromium reports no layout time for it during a scroll.🔍 Self-reviewed with selfcorrect-review
🤖 Made within harness coverage