react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.51k stars 289 forks source link

[web][safari][picker v1.16.1] Click propagates from select dropdown to parent in Safari #309

Open rSkogeby opened 3 years ago

rSkogeby commented 3 years ago

Summary Using a dropdown, on react-native-web, in safari, upon clicking on the picker an event is propagated to the parent as onTouchStart. When selecting an event in the dropdown list no event is propagated to the parent. Thus when the dropdown closes and you move the mouse around the parent registers that as a panResponderEvent , which doesn't play nicely when using e.g. a PanGestureHandler from react-native-gesture-handler. Note that I've only been able to confirm this as an issue in Safari on MacOS, and does not seem to occur in Chrome.

Reproducible demo

  1. On a mac running macOS 11.4 go to https://snack.expo.dev/@rskogeby/crabby-yogurt,

  2. Pop the web window out using the icon circled in the below screenshot

    Screenshot 2021-08-20 at 15 30 46
  3. Select an item from the list

    Screenshot 2021-08-20 at 15 38 35
  4. Drag your pointer across the window and watch the background color flicker

    Screenshot 2021-08-20 at 15 38 45

Suggestion on how to solve If we can access the underlying html component we should be able to solve it by adding an event listener which prevents the click from propagating:

Screenshot 2021-08-20 at 15 41 01