no scrollBehavior on route-change with nested nuxt-child

manniL
3.0k
manniL
commented 20 days ago

Version

v2.3.2

Reproduction link

https://github.com/davidpmccormick/btmat-nuxt

Steps to reproduce

Steps to reproduce

  1. scroll down this page: http://next.btmat.org.uk/2012
  2. click on an article excerpt link
  3. see the article render half way down the page

Here's the repo

Both the from page and the to page include scrollToTop: true.

Related: #2738
cc @davidpmccormick

What is expected ?

scrollBehavior is triggered

What is actually happening?

scrollbehavior is not triggered (no scrollToTop)

bug
0
manniL
3.0k
manniL
commented 20 days ago

Fixed if you use an index.vue file in the subfolder. (PR incoming for the repo)

https://github.com/davidpmccormick/btmat-nuxt/pull/1

0
davidpmccormick
3
davidpmccormick
commented 14 days ago

@manniL I found I was having the same issue on another page so attempted to replicate what you had done in davidpmccormick/btmat-nuxt#1 – basically changing a _pageSlug.vue file to an index.vue inside a _pageSlug directory (see here).

But while I can see the routeChanged even being emitted, and scrollToTop: true is on the route, this page doesn't scroll to the top after clicking the final news promo on the page ('Breastmilk banks') https://btmat.org.uk/2012/11/breastmilk-bomb

This appears only to be an issue when the news item is from the same year/month.

Any other ideas?

Edit: also seems to be an issue for pagination – clicking 'Older' at the bottom of the news page doesn't scroll to the top of the page

0
manniL
3.0k
manniL
commented 13 days ago

@davidpmccormick for the latter, use watchQuery

0
davidpmccormick
3
davidpmccormick
commented 12 days ago

The pagination relies on a path parameter (/page/x) rather than a query string, so I don't think watchQuery is the right fit.

It's like this because I didn't want to change the URL structure of an old WordPress install (I'd have used a query for pagination if I was setting it up from scratch).

0
davidpmccormick
3
davidpmccormick
commented 10 days ago

What's the right approach for bug reporting on this? I don't want to just open another issue, but would really like to try and figure out why triggerScroll still isn't getting called after routeChanged for certain routes.

0
manniL
3.0k
manniL
commented 10 days ago

@davidpmccormick I'd suggest to open a new Issue with a minimal reproduction repo again.

0
Informations
Bug ReportOpen
#c8200 - Created 20 days ago