Replies: 1 comment
-
Hey @rChaoz, first off thanks for the feedback. I agree with many things raised here. Though I will point out this existing issue: And specifically:
Generally speaking several things are implemented in the way they are because of the manner in which the popup system works. With Floating UI as an optional dependency. So the goal will be to get out of the way of Floating UI and let it do more of the heavy lifting. This said, I'll likely plan to close your issue soon and group it under the prior issue to avoid duplicates here. No need to echo anything from here over, as this post summarizes things fine. I would also encourage you to subscribe to the linked issue so you can be notified to updates to this. If you have any questions do feel free to reach out. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello! There are a few issues I encountered with the popup utility while I was using Skeleton. I would like to make a PR to address them but it also might break some existing functionality, so I want to know what you think.
First, something simple - this line does not actually remove the listener (same for
blur
), because a new function is created everytime you write() => close()
. I used a variable (const closeFunc = () => close()
) to fix this.Second, middleware are added if they exist in the popup store (example). I don't think this is great, as:
a) it's not documented to work this way and
b) it doesn't allow you to configure them per-popup
I fixed this by using this instead:
This does a few things:
element
pre-set (with{ element: elemArrow || null, ...middlewareArgs.arrow }
), as generally, the user will not be able to pass a reference to the DOM element in the config, I think it's counter-intuitive for the arrow to work correctly and it no longer works when you add some offset to it because the element is no longer setFinally, the
close()
function doessetTimeout()
to disable the popup after the fade-out is finished. This is great, but doesn't account for the fact that it might be opened again in-between the initialclose()
call and the timeout expiring. You can see this problem in action if you use the "hover" event and you quickly move the mouse away and back to the trigger node - it will disappear even though your mouse is still on it.I fixed this issue like this:
This immediately sets the state to 'closed'. Then, the timeout checks if the state is still closed - if not, it does nothing. Also, this allows calling
args.state
withfalse
directly. I also think here it should be called withtrue
and notpopupState.open
, but it doesn't really make a difference.Beta Was this translation helpful? Give feedback.
All reactions