Open dmtrjsg opened 1 year ago
@traumschule pls feel free to assign
@oleksanderkorn This might fix the issue
const [isDetached, setIsDetached] = useState(false)
const { styles, attributes, state } = usePopper(referenceElementRef, popperElementRef, {
placement: isDetached ? 'top-start' : 'bottom-start',
modifiers: [
{
name: 'offset',
options: {
offset: offset ?? [0, 0],
},
},
],
})
useEffect(() => {
if (referenceElementRef && boundaryElement) {
const refBox = referenceElementRef.getBoundingClientRect()
const boundaryBox = boundaryElement.getBoundingClientRect()
setIsDetached(boundaryBox.bottom + boundaryBox.y < refBox.bottom + refBox.y)
}
}, [!state, !boundaryElement])
Context
Tooltip is flipping when accounts are scrolled
Scope