Skip to content

Commit

Permalink
fix: wait for title before updating announcer (#10363)
Browse files Browse the repository at this point in the history
* fix: wait for title before updating announcer

* changeset
  • Loading branch information
geoffrich committed Jul 11, 2023
1 parent 61c3e5a commit 23d1df7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-berries-attack.md
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: wait a tick before announcing new page title
6 changes: 4 additions & 2 deletions packages/kit/src/core/sync/write_root.js
Expand Up @@ -40,7 +40,7 @@ export function write_root(manifest_data, output) {
dedent`
<!-- This file is generated by @sveltejs/kit — do not edit it! -->
<script>
import { setContext, afterUpdate, onMount } from 'svelte';
import { setContext, afterUpdate, onMount, tick } from 'svelte';
import { browser } from '$app/environment';
// stores
Expand All @@ -67,7 +67,9 @@ export function write_root(manifest_data, output) {
const unsubscribe = stores.page.subscribe(() => {
if (mounted) {
navigated = true;
title = document.title || 'untitled page';
tick().then(() => {
title = document.title || 'untitled page';
});
}
});
Expand Down

0 comments on commit 23d1df7

Please sign in to comment.