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
Docs: next-route-announcer and page transitions #32551
Comments
Hey @thebuilder thanks for opening this issue. We have taken a look and it seems there is indeed a bug. We will fix that and also update the documentation to explain how this works. 🙏 |
Hey @molebox did this ever get updated? I've encountered it just now and there's been a recent report of the same bug (#35831) I can see the Thanks :) |
As mentioned in the original issue here, #31147 was patched and released. Further, since then, we now have Accessibility documentation, which talks about route annoucements! |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What is the improvement or update you wish to see?
The
next-route-announcer
is a hidden feature in Next.js, and most of the time it will just work without you doing anything.But, one area where I see a big issue is the moment you're trying to do a page transition. Because you always have to keep the previous page in the DOM until it's animated out, it causes
next-route-announcer
to update with the title of the page you are leaving, instead of the one you're going to. The result is properly a worse a11y experience, then if it didn't exist.I've had to do some pretty ugly hacks in the past to get this to work, which included adding an extra
h1
to the page so the correct title is picked up. This specific issue can hopefully be avoided after #31147, so you can update thedocument.title
before the page transition occurs. But, since the only way you could know of this feature to begin with is to dig into the source code, most developers will not be aware they need to update the title immediately during a page transition.next-route-announcer
does, and how you can work with it.Is there any context that might help us understand?
Next.js code examples of page transitions fall into the trap:
If you try to find tutorials on how to do page transitions in Next.js, they all fall into this trap, as will all developers who have followed these guides.
Does the docs page already exist? Please link to it.
No response
The text was updated successfully, but these errors were encountered: