ReactTooltip / react-tooltip

React Tooltip Component
https://react-tooltip.com/
MIT License
3.63k stars 529 forks source link

[BUG] Placement is not working #1233

Open eduramme opened 1 week ago

eduramme commented 1 week ago

Placement is not working

Bug description The placement prop is not working correctly in height-restricted containers. When setting place="top", the tooltip appears on the right or left side instead. Using the positionStrategy prop (e.g., "fixed") doesn't resolve the issue.

Version of Package v5.26.3

To Reproduce

  1. Render a tooltip inside a height-restricted container.
  2. Set the place prop to "top".
  3. Optionally set the positionStrategy to "fixed".
  4. Observe that the tooltip does not position itself at the top as expected.

Expected behavior The tooltip should appear at the top of the target element when place="top" is set, even in height-restricted containers.

Screenshots The container has overflow-x: hidden applied and a maximum height set to 40px

image

code:

      <div data-tooltip-id={id}>{trigger}</div>
      <ReactTooltip
        id={id}
        clickable
        positionStrategy="fixed"
        place="top"
        opacity={1}
        delayHide={0}
        delayShow={0}
        className="!nk-z-50 !nk-bg-black !nk-rounded-[8px] !nk-p-0"
        openEvents={{ mouseenter: true, focus: true }}
        closeEvents={{ mouseleave: true, blur: true }}
        noArrow={false}
        arrowColor="black"
        {...props}
      >
        <div className="nk-relative nk-h-full nk-text-left nk-rounded-md nk-text-sm nk-font-medium nk-text-white nk-py-2 nk-px-4">
          {children}
        </div>
      </ReactTooltip>

Desktop (please complete the following information if possible or delete this section):

Additional context Even when trying the positionStrategy prop (e.g., "fixed"), the placement remains inconsistent. Adjustments or additional options to ensure correct positioning in height-restricted containers would be helpful.

I came across a similar issue that was closed without providing a proper solution: https://github.com/ReactTooltip/react-tooltip/issues/692

AntennaeVY commented 3 days ago

I'm experiencing the same issue right now... How have you worked around this?