Skip to content

Commit

Permalink
feat(clickable-prop): add clickable prop
Browse files Browse the repository at this point in the history
add clickable prop which enables tooltip to respond to mouse (or touch) events

fix #417
  • Loading branch information
EndiM committed Mar 6, 2019
1 parent 9e876e1 commit a75b2be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
top: -999em;
visibility: hidden;
z-index: 999;
&.allow_hover {
&.allow_hover,
&.allow_click {
pointer-events:auto;
}
&:before,
Expand Down

0 comments on commit a75b2be

Please sign in to comment.