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: nested drawer onOpenChange issue #516

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chrism
Copy link

@chrism chrism commented Nov 25, 2024

This appears to fix the open issue
Nested drawer doesn't fire onOpenChange callback #457

And also allows for the nested drawer to be controlled independently via nestedIsOpen

I noticed that the onOpenChange got removed in this commit
v0.9.2...v0.9.4#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405L1071

For my use case I also needed to open a nested drawer on route change, I've attached a short video to illustrate what I mean.

vaul.mp4

For info: to ensure that the parent drawer transitions correctly when the nested drawer is opened on route change I also needed to add this code

  React.useEffect(() => {
    setTimeout(() => {
      onNestedOpenChange(!!nestedIsOpen);
    }, TRANSITIONS.DURATION * 1000 + 50);
  }, [nestedIsOpen]);

Maybe there is a cleaner way, but it seems to work.

Thought this fix might be useful to others.

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.

1 participant