router icon indicating copy to clipboard operation
router copied to clipboard

Unexpect `scrollBehavior` about `savedPosition` in Safari and Firefox

Open abitwhy opened this issue 3 years ago • 1 comments

Version

4.0.15

Reproduction link

codesandbox.io

Steps to reproduce

  1. Open the minimal reproduction in firefox.
  2. Click the header1.
  3. Click the header2.
  4. Click the header1 agin.
  5. Click the header2 agin.

It also happened in chrome, if you scroll page to the end before click anchor link in step5.

What is expected?

Jump to the correct header.

What is actually happening?

Jump to savedPostion.


It meets code logic, but does not meet the expectations of use.

Notice: I have used CSS scroll-behavior in :root.

abitwhy avatar Jun 02 '22 09:06 abitwhy

This is due to the links being plain links instead of the router link. Using a router link is the workaround. I'm marking this as a bug for the moment because it should be possible to fix by considering pop navigations with unknown navigation direction (delta = 0) as having an invalid scroll key so they never have a saved position

posva avatar Jun 05 '22 15:06 posva