Christiano
12/01/2023, 10:45 PMfirst
page has a couple of sections and is quite long (multiple viewports high). When I'm somewhere in the middle and I click on a button to go to a new page, the new page loads perfectly (albeit it seems that the viewport seems to scroll to the top before loading the new page). Now, if the new page has a little height of 1 viewport + a couple of pixels and I want to return to the previous page, the first page will load up at the scroll position of the 2nd page. This is not really that big of a deal, but it won't be a nice UX for the actual user whom just might want to read some info about that section again.
Is this an issue that is known? Is this only an issue for my site? What would be a possible way to debug this?
I'm not sure if this is very clear what I actually have happening, so if any more information is needed don't hesitate to ask!David Herman
12/01/2023, 10:46 PMChristiano
12/01/2023, 10:47 PMDavid Herman
12/01/2023, 10:48 PMDavid Herman
12/01/2023, 10:48 PMDavid Herman
12/01/2023, 10:48 PMDavid Herman
12/01/2023, 10:49 PMChristiano
12/01/2023, 10:49 PMDavid Herman
12/01/2023, 10:52 PMDavid Herman
12/01/2023, 10:52 PMChristiano
12/01/2023, 10:57 PMDavid Herman
12/01/2023, 11:00 PMChristiano
12/01/2023, 11:04 PMservices
till it's on the top, click on read more
for tutoring
and go back to the previous page?David Herman
12/01/2023, 11:05 PMDavid Herman
12/01/2023, 11:05 PMDavid Herman
12/01/2023, 11:05 PMChristiano
12/01/2023, 11:05 PMDavid Herman
12/01/2023, 11:06 PMDavid Herman
12/01/2023, 11:06 PM/#services
David Herman
12/01/2023, 11:06 PMDavid Herman
12/01/2023, 11:07 PMChristiano
12/01/2023, 11:07 PMDavid Herman
12/01/2023, 11:07 PMDavid Herman
12/01/2023, 11:09 PMChristiano
12/01/2023, 11:10 PMWeb Development
is on the top, clicking Learn more
and returning to the previous page ๐
Christiano
12/01/2023, 11:11 PMDavid Herman
12/01/2023, 11:11 PMDavid Herman
12/01/2023, 11:11 PMDavid Herman
12/01/2023, 11:12 PMChristiano
12/01/2023, 11:14 PMDavid Herman
12/01/2023, 11:14 PMDavid Herman
12/01/2023, 11:15 PM// Index.kt
@Page
@Composable
fun HomePage() {
Box(Modifier.fillMaxWidth().height(3000.px).overflow { y(Overflow.Scroll) }, contentAlignment = Alignment.Center) {
Link("/second", "Go to the second page")
}
}
// Second.kt
@Page
@Composable
fun SecondPage() {
Box(Modifier.fillMaxWidth().height(3000.px).overflow { y(Overflow.Scroll) }, contentAlignment = Alignment.Center) {
Link("/", "Go back to the first page")
}
}
David Herman
12/01/2023, 11:16 PMChristiano
12/01/2023, 11:16 PMChristiano
12/01/2023, 11:17 PMDavid Herman
12/01/2023, 11:21 PMDavid Herman
12/01/2023, 11:21 PMChristiano
12/01/2023, 11:22 PMDavid Herman
12/01/2023, 11:22 PMDavid Herman
12/01/2023, 11:23 PMDavid Herman
12/01/2023, 11:28 PMDavid Herman
12/01/2023, 11:28 PMDavid Herman
12/01/2023, 11:29 PMDavid Herman
12/01/2023, 11:31 PMDavid Herman
12/01/2023, 11:31 PMChristiano
12/01/2023, 11:32 PMDavid Herman
12/01/2023, 11:32 PMDavid Herman
12/01/2023, 11:32 PMDavid Herman
12/01/2023, 11:32 PMDavid Herman
12/01/2023, 11:33 PMDavid Herman
12/01/2023, 11:34 PMChristiano
12/01/2023, 11:36 PMChristiano
12/01/2023, 11:36 PMDavid Herman
12/01/2023, 11:36 PMDavid Herman
12/01/2023, 11:36 PMChristiano
12/01/2023, 11:37 PMDavid Herman
12/01/2023, 11:38 PMChristiano
12/01/2023, 11:42 PMDavid Herman
12/02/2023, 12:00 AMChristiano
03/24/2024, 8:40 AMonClick
where I then tried to navigate by using pageContext.router.navigateTo("/projects")
. Doing it like this messed up the scroll location of the long page when coming back to it.
What I did now is to wrap the button in a A
and let that handle the navigation. Which does not mess up the scroll location of the long page when returning to it.David Herman
03/24/2024, 10:21 PMDavid Herman
03/24/2024, 10:22 PMDavid Herman
03/24/2024, 10:22 PMrouter.navigateTo
so I'll need to think about that a bit more