From a75b2be335defd49b9a72d9b70ebe8ffd97494d3 Mon Sep 17 00:00:00 2001 From: Endi Modric Date: Wed, 6 Mar 2019 14:40:08 +0100 Subject: [PATCH] feat(clickable-prop): add clickable prop add clickable prop which enables tooltip to respond to mouse (or touch) events fix #417 --- src/index.js | 9 ++++++--- src/index.scss | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index fb32612a4..077ad8529 100644 --- a/src/index.js +++ b/src/index.js @@ -57,13 +57,15 @@ class ReactTooltip extends React.Component { disable: PropTypes.bool, scrollHide: PropTypes.bool, resizeHide: PropTypes.bool, - wrapper: PropTypes.string + wrapper: PropTypes.string, + clickable: PropTypes.bool }; static defaultProps = { insecure: true, resizeHide: true, - wrapper: 'div' + wrapper: 'div', + clickable: false }; static supportedWrappers = ['div', 'span']; @@ -539,7 +541,8 @@ class ReactTooltip extends React.Component { {'type-error': this.state.type === 'error'}, {'type-info': this.state.type === 'info'}, {'type-light': this.state.type === 'light'}, - {'allow_hover': this.props.delayUpdate} + {'allow_hover': this.props.delayUpdate}, + {'allow_click': this.props.clickable} ) let Wrapper = this.props.wrapper diff --git a/src/index.scss b/src/index.scss index 5be5ab3b7..c6cb9347f 100644 --- a/src/index.scss +++ b/src/index.scss @@ -67,7 +67,8 @@ top: -999em; visibility: hidden; z-index: 999; - &.allow_hover { + &.allow_hover, + &.allow_click { pointer-events:auto; } &:before,