Open williamsdyyz opened 1 month ago
please help to check link
@JerryWu1234 Link updated in the original post. Apologies, I'm not too familiar with Stackblitz
I can only see that in your stackblitz @williamsdyyz
Append /link-scroll to the address in the preview pane. The share link I created already had that. But I guess not. ¯_(ツ)_/¯ I also added a link on the first page since Stackblitz and I are having a disagreement.
thanks @williamsdyyz
So the purpose of the scroll
value is for using the "back" button to go back to a route and have it "remember" the scroll position.
For navigating normally, it doesn't remember the scroll positions, only for going back in history.
Maybe this should be documented better?
@shairez Interesting. False assumption on my part. That prop is not documented at all.
In that case, the issue changes somewhat. For the use-case of showing a modal dialog that can be closed with the back button (similar to Android UX), there is no way to stop the navigation to the dialog from scrolling the underlying document to top.
I've added an example to the link-scroll page: scroll down, click "Open dialog". The dialog appears but the document scrolls to top which is undesirable. The back button nicely closes the dialog and the scroll position is restored to where it should ideally have been all along.
I guess this is really a feature request, not a bug.
Is there any existing way to achieve what I need?
Which component is affected?
Qwik Runtime
Describe the bug
I'm trying to show dialog boxes based on a search param like
<Link href="./?dialog=about" scroll={false}>About us</Link>
I need the scroll position of the document to stay put when the user clicks the link. Unfortunately scroll={false} isn't doing that.
Reproduction
https://stackblitz.com/edit/qwik-starter-wvympk?file=src%2Froutes%2Flink-scroll%2Findex.tsx
Steps to reproduce
System Info
Additional Information
No response