surveysparrow / twigs

Themeable, Customisable and Fully Accessible React Component Library from SurveySparrow
https://twigs.surveysparrow.com/
MIT License
17 stars 8 forks source link

Tooltip state is not changing if content is nullish #95

Closed akzhysparrow closed 6 days ago

akzhysparrow commented 1 week ago

Describe the bug If the content is passed as empty or null to the Tooltip component, the onOpenChange is only getting fired on mouseover. The function is not executed on mouseleave so the tooltip remains in an open state

To Reproduce Steps to reproduce the behavior:

  1. Create a Tooltip with its content as null
  2. Log the value from onOpenChange
  3. Hover and leave the tooltip trigger
  4. Check the log - it will show open value as true on mouse over but won't change to false on mouseleave

Expected behavior onOpenChange should be executed on both mouse over and mouse leave

Desktop (please complete the following information):

Additional context

Reproducible here https://codesandbox.io/s/trusting-gates-hsc2mf?file=/tooltip.tsx