Skip to content

Difficult to use button elements inside tooltip #249

Open
@jfrankl

Description

@jfrankl

I want to use a tooltip as though it is a dropdown. This seemed appropriate because Blaster does not have a dropdown component and effectively all of the functionality is the same.

Where I'm running into an issue is with including button elements in the tooltip. Because the tooltip needs to be nested in the element inside the component that triggers it, I end up with something that looks like this:

<Button>
  Open menu
  <Tooltip bg="white" trigger="click" placement="bottom-end" closeOnClickOutside>
    <Button appearance={Appearance.MINIMAL}>RCT Hub</Button>
    <Button appearance={Appearance.MINIMAL}>Logout</Button>
  </Tooltip>
</Button>

The resulting DOM is fine—the inner buttons are actually rendered outside of the outer buttons. But this code results in React warnings about nested buttons.

index.js:1446 Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>.

It would be valuable if there were a different way to connect a tooltip to the trigger element. Or, if there were a dedicated dropdown component. Having a basic dropdown with buttons comes up on most of our applications (for example, needing to make a flyout/overflow menu with some actions inside).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions