Skip to content
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

fix: adjust isDom detection #694

Merged
merged 2 commits into from
Jun 23, 2023
Merged

Conversation

pawelblaszczyk5
Copy link
Contributor

📝 Description

This PR adjusts isBrowser detection to not rely on the window variable, which can be declared in various environments, such as e.g. Deno.

⛳️ Current behavior (updates)

Currently the dom check will pass in environments that declare window variable despite not being a browser/not having a document. It can leads to the events being added on a server or a errors in case of reading values of document after checking if only window is declared.

🚀 New behavior

It adjusts the check to validate the existence of document variable, which is recommended afaik.
Prior art: TanStack/virtual#516 framer/motion#1522 https://remix.run/docs/en/1.16.1/pages/gotchas#typeof-window-checks

💣 Is this a breaking change (Yes/No):

I assume no 😃

📝 Additional Information

I wasn't sure about the changesets tbh, so I didn't generate them.

@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2023

🦋 Changeset detected

Latest commit: 2cc18ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 62 packages
Name Type
@zag-js/dom-query Patch
@zag-js/focus-visible Patch
@zag-js/number-utils Patch
@zag-js/accordion Patch
@zag-js/avatar Patch
@zag-js/carousel Patch
@zag-js/checkbox Patch
@zag-js/color-picker Patch
@zag-js/combobox Patch
@zag-js/date-picker Patch
@zag-js/dialog Patch
@zag-js/editable Patch
@zag-js/hover-card Patch
@zag-js/menu Patch
@zag-js/number-input Patch
@zag-js/pagination Patch
@zag-js/pin-input Patch
@zag-js/popover Patch
@zag-js/pressable Patch
@zag-js/radio-group Patch
@zag-js/range-slider Patch
@zag-js/rating-group Patch
@zag-js/select Patch
@zag-js/slider Patch
@zag-js/splitter Patch
@zag-js/switch Patch
@zag-js/tabs Patch
@zag-js/tags-input Patch
@zag-js/toast Patch
@zag-js/toggle Patch
@zag-js/tooltip Patch
@zag-js/transition Patch
@zag-js/aria-hidden Patch
@zag-js/auto-resize Patch
@zag-js/dismissable Patch
@zag-js/focus-scope Patch
@zag-js/interact-outside Patch
@zag-js/popper Patch
@zag-js/remove-scroll Patch
@zag-js/tabbable Patch
@zag-js/text-selection Patch
@zag-js/dom-event Patch
@zag-js/anatomy Patch
@zag-js/core Patch
@zag-js/docs Patch
@zag-js/react Patch
@zag-js/solid Patch
@zag-js/svelte Patch
@zag-js/vue Patch
@zag-js/store Patch
@zag-js/types Patch
@zag-js/color-utils Patch
@zag-js/utils Patch
@zag-js/date-utils Patch
@zag-js/element-rect Patch
@zag-js/element-size Patch
@zag-js/form-utils Patch
@zag-js/live-region Patch
@zag-js/mutation-observer Patch
@zag-js/numeric-range Patch
@zag-js/rect-utils Patch
@zag-js/visually-hidden Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
zag-nextjs 🛑 Canceled (Inspect) Jun 23, 2023 2:40pm
zag-solid 🛑 Canceled (Inspect) Jun 23, 2023 2:40pm
zag-vue 🛑 Canceled (Inspect) Jun 23, 2023 2:40pm

@segunadebayo segunadebayo merged commit 775f11c into chakra-ui:main Jun 23, 2023
@vercel vercel bot temporarily deployed to Preview – zag-nextjs June 23, 2023 14:39 Inactive
@vercel vercel bot temporarily deployed to Preview – zag-solid June 23, 2023 14:40 Inactive
@vercel vercel bot temporarily deployed to Preview – zag-vue June 23, 2023 14:40 Inactive
@github-actions github-actions bot mentioned this pull request Jun 23, 2023
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.

2 participants