Skip to content

fix: Make the polyfill SSR-safe (early-return when Element or Document doesn’t exist)#36

Merged
smockle merged 2 commits intomainfrom
smockle/ssr-safe
Jan 14, 2026
Merged

fix: Make the polyfill SSR-safe (early-return when Element or Document doesn’t exist)#36
smockle merged 2 commits intomainfrom
smockle/ssr-safe

Conversation

@smockle
Copy link
Copy Markdown
Contributor

@smockle smockle commented Jan 14, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the ariaNotify polyfill SSR-safe by adding runtime checks to ensure Element and Document are defined before attempting to access their prototypes. This prevents errors when the polyfill is imported in server-side rendering contexts where DOM APIs are not available.

Changes:

  • Added runtime checks for globalThis.Element and globalThis.Document before accessing their prototypes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@smockle smockle merged commit a720283 into main Jan 14, 2026
4 checks passed
@smockle smockle deleted the smockle/ssr-safe branch January 14, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants