question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use a Tooltip component with a Tab

See original GitHub issue
  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

If I wrap a Tab component in a Tooltip I expect the Tab component to continue reacting to click events

Current Behavior

If the Tab component is wrapped in a Tooltip, any onChange handler specified in the Tabs component to continue operation while the tool tip still displays as normal.

I have made a sandbox here https://codesandbox.io/s/20p06mnxq0 using the material ui example. As you can see it’s possible to switch between Item two and item three but not back to item one.

Current behaviour is that the Tab doesn’t switch.

Examples

i’m on v1.4.0 Sandbox illustrating problem is here https://codesandbox.io/s/20p06mnxq0

Context

I’m trying to add tooltips to each Tab inside a parent Tabs container to help remove ambiguity concerning the icons I have used for the tabs.

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

25reactions
oliviertassinaricommented, Jan 24, 2019

@dimitry12 Here are two options with a disabled tab:

function CloneProps(props) {
  const { children, ...other } = props;
  return children(other);
}

// ...

        <Tabs value={value} onChange={handleChange}>
          <Tab
            label={
              <Tooltip title="can't change back">
                <span>Item One</span>
              </Tooltip>
            }
          />
          <CloneProps>
            {tabProps => (
              <Tooltip title="can't change back">
                <div>
                  <Tab {...tabProps} disabled label={<span>Item Two</span>} />
                </div>
              </Tooltip>
            )}
          </CloneProps>
          <Tab
            style={{ pointerEvents: "auto" }}
            disabled
            label={
              <Tooltip title="can't change back">
                <span>Item Three</span>
              </Tooltip>
            }
          />
        </Tabs>

https://codesandbox.io/s/wy3wwlypol

2reactions
oliviertassinaricommented, Jan 24, 2019
          <Tabs value={value} onChange={this.handleChange}>
            <Tab
              label={
                <Tooltip title="can't change back">
                  <span>Item One</span>
                </Tooltip>
              }
            />
            <Tab label="Item Two" />
            <Tab label="Item Three" href="#basic-tabs" />
          </Tabs>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a Tooltip component with a Tab #12597 - mui/material-ui
I'm trying to add tooltips to each Tab inside a parent Tabs container to help remove ambiguity concerning the icons I have used...
Read more >
Add Tooltip to Tab component Material UI - Stack Overflow
I can easily add the Toolip to the Tabs component by wrapping the Tabs component like this <Tooltip><Tabs /></Tooltip> but performing the same ......
Read more >
How to Display tooltip on tab header in React Tabs component
You can display tooltip for the tab component header using beforeRender event of React Tooltip component which can be viewed as hint texts...
Read more >
Building a tooltip component - web.dev
A tooltip is a non-modal, non-blocking, non-interactive overlay containing supplemental information to user interfaces. It is hidden by default ...
Read more >
React Tooltip component - Material UI - MUI
You can use the open , onOpen and onClose props to control the behavior of the tooltip. Controlled.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found