Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visibility on tooltip hover, custom JSX inside tooltip #35

Closed
artaommahe opened this issue Sep 12, 2015 · 10 comments
Closed

Visibility on tooltip hover, custom JSX inside tooltip #35

artaommahe opened this issue Sep 12, 2015 · 10 comments

Comments

@artaommahe
Copy link

I think it's really useful things

  • prevent tooltip hide on tooltip hover(mb option?)
  • allow JSX objects for tooltip content

This things at least let you to add links inside tooltip that can be clicked

@artaommahe artaommahe changed the title Tooltip visibility on tooltip hover, custom JSX inside tooltip Visibility on tooltip hover, custom JSX inside tooltip Sep 13, 2015
@wwayne
Copy link
Collaborator

wwayne commented Oct 12, 2015

allow JSX objects for tooltip content

This feature has been supported
Example: http://wwayne.github.io/react-tooltip/
HISTORY.MD: https://github.com/wwayne/react-tooltip/blob/master/HISTORY.md

@artaommahe
Copy link
Author

Thx :)

@artaommahe
Copy link
Author

What about tooltip visibility on hover for solid state?

@wwayne
Copy link
Collaborator

wwayne commented Oct 15, 2015

@artaommahe
Sorry I didn't get you, can you explain more details to me?

or you mean this? prevent tooltip hide on tooltip hover

@artaommahe
Copy link
Author

Yep. It's very usefull for placing links in tooltip, e.x.

Some description ... read more

now i can't do this cause tooltips hides on parent element hover lost, and it's forced me to use another tooltip lib just for this case

wwayne added a commit that referenced this issue Oct 15, 2015
@wwayne
Copy link
Collaborator

wwayne commented Oct 15, 2015

@artaommahe
Done, you can combine using the feature class and delayHide of react-tooltip to achieve this:

<a data-tip="tooltip" data-class="extra" data-delay-hide="500"></a>
<ReactTooltip />

.extra {
 &:hover {
   visibility: visible !important;
   opacity: 1 !important;
 }
}

@wwayne wwayne closed this as completed Oct 15, 2015
@artaommahe
Copy link
Author

Thanks, now i can rid of second tooltip lib :)

@tnrich
Copy link

tnrich commented Mar 5, 2016

Hey there @wwayne , I'm having trouble getting this to work, but I'm not quite sure why..It doesn't seem as if the hover state is being activated when I hover over the tooltip element. If I manually activate the hover state in the chrome console, the tooltip will remain popped up.

Here's some code snippets of what I'm trying to do:

.extra {
    &:hover {
        visibility: visible !important;
        opacity: 1 !important;
    }
}

.__react_component_tooltip {
    top: 0px !important;
    left: 0px !important;



    background: none !important;
    color: black !important;
    &:after{
        border-top: none !important;
    }
    span {
        background: white;
    }
}
<foreignObject x={x3} y={y3}>
          <div className='labelTooltip' style={{position: 'relative'}}>
            <ReactTooltip effect='solid' delayHide={100} offset={{top: 0, left: 0}} id={'tooltip' + key}>
              <div>
                {labels.map(function(label){
                  return <div>
                    <span>
                      {label.text}
                    </span>
                  </div>
                })}
              </div>
            </ReactTooltip>
          </div>
        </foreignObject>


<text
        data-tip
        data-class="extra"
        // data-delay-hide="500"
        data-for={'tooltip' + key}
        key={'text' + key}
        className='dragMe clickable'
        x={x3}
        y={y3}
        style={ {textAnchor: x3 > 0 ? "start" : "end", fontSize: '12px'} }>
        {text + (multipleLabels ? '...' : '')}
      </text>

Thanks for the help!

Thomas

@wwayne
Copy link
Collaborator

wwayne commented Mar 5, 2016

@tnrich I haven't seen anything wrong with JS part, but I wonder why you change the css of the class __react_component_tooltip? I doubt top: 0px !important; left: 0px !important; makes the tooltip become abnormal.
PS: you can omit offset={{top: 0, left: 0}}

Feel free to ask me if you still have problem.

@mklimkin0190
Copy link

In case anybody has the same problem as @tnrich did, with hover not triggering, add pointer-events: auto !important; to the .extra css class. Found here: #227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants