Skip to content
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

Refine scrolling into view in new router #38682

Merged
merged 1 commit into from Jul 15, 2022

Conversation

timneutkens
Copy link
Member

The first version uses element.scrollIntoView() but this doesn't take into account when the element is already visble on screen, this change ensures that there is no scroll when you're already viewing the layout where a change happens.

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running pnpm lint
  • The examples guidelines are followed from our contributing doc

@ijjk
Copy link
Member

ijjk commented Jul 15, 2022

Failing test suites

Commit: a1b06e8

pnpm testheadless test/e2e/app-dir/index.test.ts

  • app dir > > should soft push
Expand output

● app dir › › should soft push

page.waitForSelector: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for selector "#link"
============================================================

  304 |     return this.chain(() => {
  305 |       return page
> 306 |         .waitForSelector(selector, { timeout, state: 'attached' })
      |          ^
  307 |         .then(async (el) => {
  308 |           // it seems selenium waits longer and tests rely on this behavior
  309 |           // so we wait for the load event fire before returning

  at lib/browsers/playwright.ts:306:10

Read more about building and testing Next.js in contributing.md.

@timneutkens timneutkens merged commit 083f052 into vercel:canary Jul 15, 2022
timneutkens added a commit to timneutkens/next.js that referenced this pull request Jul 15, 2022
Follow-up to vercel#38682. Instead of checking if the full element is in the viewport we only check if the top of the element is in the viewport. If it is not we have to scroll back up in cases of navigating between items in the same layout for example.
timneutkens added a commit that referenced this pull request Jul 15, 2022
Follow-up to #38682. Instead of checking if the full element is in the viewport we only check if the top of the element is in the viewport. If it is not we have to scroll back up in cases of navigating between items in the same layout for example.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants