-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
1433: Add support for sl-popup "virtualAnchor" #1434
1433: Add support for sl-popup "virtualAnchor" #1434
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Yep, after looking at the PR, a separate property does feel kinda weird. Feel free to merge it all into I'd love to see an example in the docs for this. Probably something similar to what Floating UI has with it following the mouse cursor. I'm more than happy to provide that if you don't want to. Looking forward to this one! |
This is super cool! Agreed with @claviska in that I'd expect it to all just be under "anchor" Is there ever a case where you would use both an anchor and a virtual anchor?? |
That was my [poor] suggestion from early on. In hindsight, it makes sense to keep it all under |
Hey @grokwich! I noticed you merged the properties into Are you still working on this PR, or did you want us to take it from here, review it, and update the docs/changelog? |
Hello @claviska and crew. Here is a little prototype that demo's the latest code in the branch... https://codepen.io/marko333/pen/JjeOzvJ/9b72ce661ccd024cfd0578460c180a6f The popup appears anywhere the mouse is clicked. I was getting some FOUC on the initial render of the inactive popup, but i applied your I set A couple of issues to think about...
Feel free to take over, or if there is anything else you would like me to do, i am willing. You may want to at least take the doc work, just to ensure it's consistent with the great work done upto now (love the doc btw!-). Thx |
Thanks for your work on this! A subsequent PR including these changes plus documentation has been created in #1449. |
This is by no means complete, but i wanted to get this in front of you Cory (and others) to get feedback.
Btw, build.watch() was not working for me until i made the change noted in the diff?
Cory, i know you felt like adding a new "virtualAnchor" property would be best, but the Float-UI anchor-element type is already a union of a real element + virtualElement.
Also, it should not really be allowed to set both the "anchor" and "virtualAnchor" properties. We avoid that possibility if we just overloaded the "anchor" property to accept a VirtualElement.
Instead of aliasing the Float-UI VirtualElement type, i just used the Dom return type of getBoundingClientRect() : DOMRect
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
DOMRect feels like a more portable.
I also limited the VirtualElement type to just the getBoundingClientRect() call. The other Float-UI VirtualElement members are optional and seemed to be pretty specialized scenarios, so i figured that starting here would give us the core meat, and you can always expand SLPopup.VirtualElement as a future enhancement.
Let me know what you think?