Skip to content

Commit

Permalink
fix active element on ssr (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
TGlide authored May 23, 2024
1 parent 68143e7 commit 24e0c34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-buttons-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"runed": patch
---

fix active element erroring on SSR
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Readable } from "../Readable/readable.svelte.js";
import { isBrowser } from "$lib/internal/utils/browser.js";

/**
* An object holding a reactive value that is equal to `document.activeElement`.
Expand All @@ -8,6 +9,7 @@ import { Readable } from "../Readable/readable.svelte.js";
*/
export const activeElement = new Readable<Element | null>(null, (set, insideEffect) => {
function update() {
if (!isBrowser()) return;
set(document.activeElement);
}

Expand Down

0 comments on commit 24e0c34

Please sign in to comment.