airbnb / airbnb/react-outside-click-handler

Prevented default in onPointerDown does not trigger onOutsideClick

Open
#16 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
611
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Repro: https://codesandbox.io/s/p9jl7jq627

Clicking on a `div` with `mouseDown` default preventer triggers `onOutsideClick`, while clicking on a `div` with `pointerDown` default preventer does not.

This is because `mouseDown` will not be fired if the default is prevented in `pointerDown`, see step 6 under 7.1 in [Pointer Events Specification](https://www.w3.org/Submission/pointer-events/#mapping-for-devices-that-support-hover).

Is this something that this library should support? I tried switching `mouseDown` -> `pointerDown` and `mouseUp` -> `pointerUp` and everything seemed to work like it should.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked CodeSandbox reproduction and the Pointer Events Specification section cited in the issue, then inspect the component's existing mouseDown and mouseUp event handling. Done means a pointerDown default-preventer triggers onOutsideClick consistently with the mouseDown case, with behavior verified against the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.