Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit bc2e328

Browse files
author
xhlulu
committed
Remove hoverAreaStyle and hoverAreaClassName
It's not clear how those props will be used and could be confusing. It's better to remove them for now and add them later if needed
1 parent e126a2e commit bc2e328

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/components/AbsoluteTooltip.react.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ const AbsoluteTooltip = props => {
1111

1212
return (
1313
<>
14-
<div
15-
className={`dcc-tooltip-bounding-box ${props.hoverAreaClassName}`}
16-
style={props.hoverAreaStyle}
17-
>
14+
<div className={`dcc-tooltip-bounding-box`}>
1815
<span
1916
data-dash-is-loading={
2017
(loading_state && loading_state.is_loading) || undefined
@@ -37,11 +34,13 @@ const AbsoluteTooltip = props => {
3734
width: ${bbox.x1 - bbox.x0}px;
3835
height: ${bbox.y1 - bbox.y0}px;
3936
display: ${props.show ? 'inline-block' : 'none'};
37+
pointer-events: ${props.targetable ? 'auto' : 'none'};
4038
}
4139
4240
.hover {
4341
position: absolute;
4442
}
43+
4544
.hover-right {
4645
/* Offset so that the triangle caret lands directly on what's hovered */
4746
transform: translate(5px, 0);
@@ -73,6 +72,7 @@ const AbsoluteTooltip = props => {
7372
background: ${colors.background};
7473
white-space: nowrap;
7574
z-index: ${props.zindex};
75+
pointer-events: none;
7676
}
7777
7878
.hover .hover-content,
@@ -203,12 +203,12 @@ const AbsoluteTooltip = props => {
203203

204204
AbsoluteTooltip.defaultProps = {
205205
show: true,
206+
targetable: false,
206207
direction: 'right',
207208
colors: {
208209
border: '#d6d6d6',
209210
background: 'white',
210211
},
211-
hoverAreaClassName: '',
212212
className: '',
213213
zindex: 1,
214214
};
@@ -231,21 +231,12 @@ AbsoluteTooltip.propTypes = {
231231
* The class of the tooltip
232232
*/
233233
className: PropTypes.string,
234-
/**
235-
* The class of the invisible area determined by `bbox`. When you hover over that area, the tooltip will appear.
236-
*/
237-
hoverAreaClassName: PropTypes.string,
238234

239235
/**
240236
* The style of the tooltip
241237
*/
242238
style: PropTypes.object,
243239

244-
/**
245-
* The style of the invisible area determined by `bbox`. When you hover over that area, the tooltip will appear.
246-
*/
247-
hoverAreaStyle: PropTypes.object,
248-
249240
/**
250241
* Dash-assigned callback that gets fired when the value changes.
251242
*/
@@ -312,6 +303,12 @@ AbsoluteTooltip.propTypes = {
312303
* This corresponds to the `z-index` CSS property you want to assign to the tooltip. Components with higher values will be displayed first on the screen.
313304
*/
314305
zindex: PropTypes.number,
306+
307+
/**
308+
* Whether the tooltip can be targeted (hovered, selected, interacted) or not. When set to `False`,
309+
* the tooltip's `pointer-events` CSS property will be `none` and it can't be the target of pointer events.
310+
*/
311+
targetable: PropTypes.bool,
315312
};
316313

317314
export default AbsoluteTooltip;

0 commit comments

Comments
 (0)