React-tooltip: button onClick handler doesn't trigger, if the button is inside ReactTooltip Component.

Created on 20 Apr 2016  路  3Comments  路  Source: wwayne/react-tooltip

<a ref='settings_tooltip' data-for="settings" data-multiline="true" data-tip data-type="light" href="#">
     <span>Test Link</span>
</a>
<ReactTooltip ref='tooltip_container' id="settings" place="right" effect="solid">
   <div>
       <h5>Title</h5>
       <button onClick={this.handleTooltipClick.bind(this)}>Click</button>
       some content lorem ipsum<br/> some content lorem ipsum
      </div>
</ReactTooltip>

'handleTooltipClick' is not triggering on onclick event.

Most helpful comment

@kokill, you'll need to set pointer-events: auto; in your css; as the default styling for the whole reacttooltip container sets pointer-events: none;.

All 3 comments

@kokill, you'll need to set pointer-events: auto; in your css; as the default styling for the whole reacttooltip container sets pointer-events: none;.

@kokill, @megalithic is correct, the pointer-events: none as default, you can modify it to, for example:

<a data-tip data-for="settings"></a>
<ReactTooltip id="settings" delayHide={500} class="extra" />

.extra {
 pointer-events: auto !important;
 &:hover {
   visibility: visible !important;
   opacity: 1 !important;
 }
}

Using delayHide here so that you can hover to the tooltip

@wwayne i feel like this should be mentioned in the readme. Perhaps even a prop? and default to false when the prop isn't present

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abijames picture abijames  路  3Comments

lovetann picture lovetann  路  3Comments

antofa picture antofa  路  4Comments

bonbonio picture bonbonio  路  4Comments

jhlee4 picture jhlee4  路  3Comments