Skip to content

Commit 24cd233

Browse files
committed
remove stopPropagation usage and rely on preventDefault to make sure either click or touchend gets triggered at a time, whichever is triggered first
1 parent 4339109 commit 24cd233

File tree

6 files changed

+185
-136
lines changed

6 files changed

+185
-136
lines changed

.size-snapshot.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"dist/cjs/react-popper-tooltip.js": {
3-
"bundled": 14634,
4-
"minified": 7853,
5-
"gzipped": 2322
3+
"bundled": 14603,
4+
"minified": 7833,
5+
"gzipped": 2309
66
},
77
"dist/esm/react-popper-tooltip.js": {
8-
"bundled": 14595,
9-
"minified": 7829,
10-
"gzipped": 2316,
8+
"bundled": 14564,
9+
"minified": 7809,
10+
"gzipped": 2303,
1111
"treeshaked": {
1212
"rollup": {
1313
"code": 172,
1414
"import_statements": 152
1515
},
1616
"webpack": {
17-
"code": 8537
17+
"code": 8517
1818
}
1919
}
2020
}

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Each placement can have a variation from this list:
237237

238238
> `string` | defaults to `hover`
239239
240-
The event that triggers the tooltip. One of `click`, `hover`, `right-click`, `focus`, `none`.
240+
The event that triggers the tooltip. One of `click`, `right-click`, `hover`, `focus`, and `none`.
241241

242242
### getTriggerRef
243243

@@ -297,14 +297,12 @@ displays the tooltip itself.
297297

298298
You use it like so:
299299

300-
```
300+
```jsx
301301
const tooltip = (
302-
<TooltipTrigger
303-
tooltip={tooltip => (<div>{/* more jsx here */}</div>)}
304-
>
305-
{trigger => (<div>{/* more jsx here */}</div>)}
302+
<TooltipTrigger tooltip={tooltip => <div>{/* more jsx here */}</div>}>
303+
{trigger => <div>{/* more jsx here */}</div>}
306304
</TooltipTrigger>
307-
)
305+
);
308306
```
309307

310308
### prop getters

docs/readme.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ _`followCursor` prop_
8484
tooltip="Hello, World!"
8585
placement="top"
8686
>
87-
<button>Focus me!</button>
87+
<input placeholder="Focus me!" style={{width: 70}} />
8888
</BasicTooltipTrigger>
8989
<BasicTooltipTrigger trigger="focus" tooltip="Hello, World!">
90-
<button>Focus me too!</button>
90+
<input placeholder="Focus me too!" style={{width: 70}} />
9191
</BasicTooltipTrigger>
9292
</div>
9393
<div style={{flex: 3, fontSize: 12, textAlign: 'center', padding: 50}}>
9494
Click inside this area and focus using the Tab key on desktop. On mobile,
95-
just click on the buttons.
95+
just click on the inputs.
9696
</div>
9797
</div>
9898
</Playground>

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-popper-tooltip",
3-
"version": "2.9.0",
3+
"version": "2.9.1",
44
"description": "React tooltip library built around react-popper",
55
"homepage": "https://react-popper-tooltip.netlify.com",
66
"repository": {
@@ -46,16 +46,16 @@
4646
"react-dom": "^16.6.0"
4747
},
4848
"dependencies": {
49-
"@babel/runtime": "^7.6.2",
49+
"@babel/runtime": "^7.6.3",
5050
"react-popper": "^1.3.4"
5151
},
5252
"devDependencies": {
53-
"@babel/cli": "^7.6.2",
54-
"@babel/core": "^7.6.2",
53+
"@babel/cli": "^7.6.3",
54+
"@babel/core": "^7.6.3",
5555
"@babel/plugin-proposal-class-properties": "^7.5.5",
5656
"@babel/plugin-transform-runtime": "^7.6.2",
57-
"@babel/preset-env": "^7.6.2",
58-
"@babel/preset-react": "^7.0.0",
57+
"@babel/preset-env": "^7.6.3",
58+
"@babel/preset-react": "^7.6.3",
5959
"@babel/preset-typescript": "^7.6.0",
6060
"@testing-library/react": "^9.3.0",
6161
"@types/jest": "^24.0.18",
@@ -76,11 +76,11 @@
7676
"prettier": "^1.18.2",
7777
"react": "^16.10.2",
7878
"react-dom": "^16.10.2",
79-
"react-hot-loader": "^4.12.14",
79+
"react-hot-loader": "^4.12.15",
8080
"rollup": "^1.23.1",
8181
"rollup-plugin-babel": "^4.3.3",
8282
"rollup-plugin-node-resolve": "^5.2.0",
8383
"rollup-plugin-size-snapshot": "^0.10.0",
84-
"typescript": "^3.6.3"
84+
"typescript": "^3.6.4"
8585
}
8686
}

src/TooltipTrigger.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ class TooltipTrigger extends Component<
191191
};
192192

193193
private clickToggle: React.MouseEventHandler = (event: React.MouseEvent) => {
194-
event.stopPropagation();
195194
event.preventDefault();
196195
const {pageX, pageY} = event;
197196
const action = this.props.followCursor ? 'showTooltip' : 'toggleTooltip';

0 commit comments

Comments
 (0)