Skip to content

Tooltip is incompatible with callback refs #8378

Description

@iansan5653

Description

When I encountered #8373 I moved my callback ref to the wrapping Tooltip . This appeared to forward the ref to the underlying element as I wanted. However, if the passed ref is a callback ref, the tooltip never appears. This is not the case for an object ref.

Steps to reproduce

This breaks, even though it typechecks just fine. The log does get called, but the tooltip does not appear:

const logRef = useCallback(element => console.log(element), [])

return <Tooltip ref={logRef} text="Example"><Button>Button text</Button></Tooltip>

This works, but isn't a callback ref:

const logRef = useRef(null)

return <Tooltip ref={logRef} text="Example"><Button>Button text</Button></Tooltip>

And this shows the tooltip but never calls the log (#8373):

const logRef = useCallback(element => console.log(element), [])

return <Tooltip text="Example"><Button ref={logRef}>Button text</Button></Tooltip>

Version

v38.37.0

Browser

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions