-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Sub-optimal page title vocal announcement #24021
Comments
Thanks @KittyGiraudel, yeah I like the idea of taking |
…31147) ## Improvement This pull-request should address #24021, improving the page change announcement for assistive technologies by giving priority to `document.title` over `h1`. Interestingly, it would also improve a potential performance bottleneck by skipping calls to `innerText` on the main `h1` raised in [this comment](#20428 (comment)).
Just started work on a new client's NextJS app today and was happy to find this issue was already reported and that @KittyGiraudel happened to fix it today. Thank you for this! I'm excited to inherit this improvement, since it's something I noted in my initial accessibility assessment. |
@shuding Shall we close this? |
Oops, sure this can be closed now! |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.1.x
What version of Node.js are you using?
14.15.x
What browser are you using?
Brave
What operating system are you using?
macOS
How are you deploying your application?
next export
Describe the Bug
Originally issued as a comment: #23086 (comment).
PR #23086 introduced an accessibility improvement aiming at making same-page routing more accessible by voicing the page title upon route change. That’s great, and it works alright as far as I can tell. That being said, I think the logic might be a little backwards.
In my opinion, we should use the
document.title
first if available, since this is what would happen in a non-SPA scenario upon page change. And if we do not have a page title, then we should use theh1
(if any, of course). Right now it will announce the content of theh1
, despite having a perfectly cleandocument.title
, which I think is not the best experience.next.js/packages/next/client/route-announcer.tsx
Lines 15 to 40 in 19accb6
I’m happy opening an issue/PR if you think this is a valid concern.
Pinging @kyleboss, @shuding and @olpeh since they were all involved in the PR.
Expected Behavior
Taking the home page of the Gorillas website as an example: the page title is “Home | Gorillas” while the
h1
is “Groceries delivered in 10 minutes”. Navigating to the home page should announce “Home | Gorillas”, not the baseline (or catch phrase, or whatever we want to name it). And while in many cases, theh1
and thedocument.title
would be in sync, I believe this is not always the case. In a case like this, we also don’t want theh1
to just contain “Home.”To Reproduce
The text was updated successfully, but these errors were encountered: