-
Notifications
You must be signed in to change notification settings - Fork 61
feat: add public scroll to page method #1791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da46d77d16
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const pageEl = getPageElementByIndex(this.#viewportHost, pageIndex); | ||
| if (pageEl) { | ||
| pageEl.scrollIntoView({ block: 'start', inline: 'nearest', behavior: scrollBehavior }); | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scroll even when target page isn't mounted
This implementation only calls scrollIntoView if getPageElementByIndex returns an element, and otherwise returns false without changing scroll. When page virtualization is enabled, off‑screen pages are often not mounted in the DOM, so getPageElementByIndex will return null even for valid pages; in that case scrollToPage cannot bring the page into view at all. This makes the new public API fail for any page outside the mounted window. Consider using the same approach as other navigation helpers (e.g., scroll to the computed y‑position and/or wait for mount) so virtualized pages can be reached.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing this fix
da46d77 to
76f836b
Compare
|
@harbournick this is ready for your review when you get a chance |
No description provided.