Skip to content

Commit 7753855

Browse files
committed
fix pointer-events
1 parent 0e309c0 commit 7753855

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,11 @@ Just ask me, I'll add you as collaborator! Any help I can get to make better sof
113113
## Shoutouts
114114

115115
This was originally written during some freelance work for [Spectrum](https://spectrum.chat/). Shoutout to their awesomeness for letting me do all my work for them in the open!
116+
117+
## TODO:
118+
write test for all states:
119+
- Test pointerEvents are correct
120+
- Test isOpen overrides anything internal
121+
- Test placement strategies
122+
- Test refs
123+
- Test events being only inside selection ref

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-text-selection-popover",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "",
55
"author": "juliankrispel",
66
"license": "MIT",

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ class Popover extends Component {
105105
target={document}
106106
onSelectionChange={this.updatePosition}
107107
/>,
108-
selectionRef && selectionRef.current && <EventListener
108+
<EventListener
109109
key="on-mouse-up"
110-
target={selectionRef.current}
110+
target={selectionRef && selectionRef.current ? selectionRef.current : document}
111111
onMouseUp={() => this.setState({ mousePressed: false })}
112112
/>,
113-
selectionRef && selectionRef.current && <EventListener
113+
<EventListener
114114
key="on-mouse-down"
115-
target={selectionRef.current}
115+
target={selectionRef && selectionRef.current ? selectionRef.current : document}
116116
onMouseDown={() => this.setState({ mousePressed: true })}
117117
/>,
118118
selectionPosition == null || !isOpen || contentRect.bounds.width == 0 ? null : (

0 commit comments

Comments
 (0)