Skip to content

fix(popover): restart tracked positioning for lazy-mounted positioners#3092

Draft
aleclarson wants to merge 1 commit intochakra-ui:mainfrom
aleclarson:fix/lazy-popover
Draft

fix(popover): restart tracked positioning for lazy-mounted positioners#3092
aleclarson wants to merge 1 commit intochakra-ui:mainfrom
aleclarson:fix/lazy-popover

Conversation

@aleclarson
Copy link
Copy Markdown
Contributor

Description

Restarts the tracked popover positioning session when a lazy-mounted positioner appears, so observers can attach after the floating node exists.

⛳️ Current behavior (updates)

Controlled, lazy-mounted popovers can miss the initial tracked positioning pass because the positioner is not in the DOM yet.

New behavior

The machine now has a dedicated restartPositioning() path for rebuilding the tracked positioning session after mount. reposition() stays as the one-shot manual path.

Is this a breaking change (Yes/No):

No

Additional Information

This is still a draft. I did not add tests, and I won't have time to push this through to the finish from here. If this direction looks useful, it'd be great if someone could pick it up. Thanks for your time.

This change introduces a restartPositioning method to the popover API, allowing users
to manually restart the positioning session.

It also refactors how positioning is tracked internally by using a ref to store
the cleanup function. This ensures that the positioning session can be properly
restarted or cleaned up without relying solely on the effect lifecycle.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zag-nextjs Ready Ready Preview Apr 20, 2026 7:51pm
zag-solid Ready Ready Preview Apr 20, 2026 7:51pm
zag-svelte Error Error Apr 20, 2026 7:51pm
zag-vue Ready Ready Preview Apr 20, 2026 7:51pm
zag-website Ready Ready Preview Apr 20, 2026 7:51pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

⚠️ No Changeset found

Latest commit: f9da30c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@segunadebayo
Copy link
Copy Markdown
Member

Hey! Could you show a reproduction of the issue you’re attempting to fix?

@aleclarson
Copy link
Copy Markdown
Contributor Author

It seems to be an issue with Preact only. Though I wasn't using @zag-js/preact in place of @zag-js/react. Let me try that and I'll see if this is still an issue or not. ✌️

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