Skip to content

Commit

Permalink
web: remove built-in sveltekit announcer (for real this time)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmoron committed Sep 7, 2024
1 parent 3fdfd44 commit b4f1748
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 0 additions & 6 deletions web/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import "@fontsource/ibm-plex-mono/400-italic.css";
import "@fontsource/ibm-plex-mono/500.css";
import { beforeUpdate } from "svelte";
import { page } from "$app/stores";
import { updated } from "$app/stores";
import { browser } from "$app/environment";
Expand Down Expand Up @@ -35,10 +33,6 @@
document.querySelector("[data-first-focus]");
to_focus?.focus();
});
beforeUpdate(() => {
document.getElementById("svelte-announcer")?.remove();
})
</script>

<svelte:head>
Expand Down
11 changes: 11 additions & 0 deletions web/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ const config = {
// for more information about preprocessors
extensions: [".svelte", ".md"],
preprocess: [
{
name: "strip-announcer",
markup: ({ content: code }) => {
code = code.replace(
/<div id="svelte-announcer" [\s\S]*?<\/div>/,
'<svelte:component this={null} />'
);

return { code }
}
},
sveltePreprocess(),
mdsvex({
extensions: ['.md'],
Expand Down

0 comments on commit b4f1748

Please sign in to comment.