Skip to content

Commit fb36d60

Browse files
Add section about Pointer Events
This PR adds a section about the state of Pointer Events in React. This should be merged only if facebook/react#12507 is accepted as well.
1 parent d7f675d commit fb36d60

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

content/docs/reference-events.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ The event handlers below are triggered by an event in the bubbling phase. To reg
7676
- [Focus Events](#focus-events)
7777
- [Form Events](#form-events)
7878
- [Mouse Events](#mouse-events)
79+
- [Pointer Events](#pointer-events)
7980
- [Selection Events](#selection-events)
8081
- [Touch Events](#touch-events)
8182
- [UI Events](#ui-events)
@@ -215,6 +216,40 @@ boolean shiftKey
215216

216217
* * *
217218

219+
### Pointer Events
220+
221+
Event names:
222+
223+
```
224+
onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture
225+
onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut
226+
```
227+
228+
The `onPointerEnter` and `onPointerLeave` events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.
229+
230+
Properties:
231+
232+
As defined in the [W3 spec](https://www.w3.org/TR/pointerevents/), pointer events extend [Mouse Events](#mouse-events) with the following properties:
233+
234+
```javascript
235+
number pointerId
236+
number width
237+
number height
238+
number pressure
239+
number tiltX
240+
number tiltY
241+
string pointerType
242+
boolean isPrimary
243+
```
244+
245+
A note on cross-browser support:
246+
247+
Pointer events are not yet supported in every browser (at the time of writing this article, supported browsers include: Chrome, Firefox, Edge, and Internet Explorer). React deliberately does not polyfill support for other browsers because a standard-conform polyfill would significantly increase the bundle size of `react-dom`.
248+
249+
If your application requires pointer events, we recommend adding a third party pointer event polyfill like [PEP](https://github.com/jquery/PEP).
250+
251+
* * *
252+
218253
### Selection Events
219254

220255
Event names:

0 commit comments

Comments
 (0)