FormidableLabs / FormidableLabs/react-swipeable

`preventScrollOnSwipe` does not work while focused on input

Abierto
#335 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
2.1k
Forks
149
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Describe the bug**
When an input field is focused on ios Safari, preventScroll flag does not work as intended, IE, the page still scrolls.

**Steps or Sandbox to reproduce**
This has to be reproduced inside an ios simulator like xCode or on your mobile device directly
- Wrap a div with scroll handlers:
```js
const handlers = useSwipeable({
onSwiping: ({ deltaY }) => {
if (deltaY > 100) {
document.getElementById('AddModal').close();
}
},
delta: { left: 100, right: 100, down: 100 },
preventScrollOnSwipe: true,
});
```
- Place an input inside of this container
- Place a `ref` on this input
- when the component mounts, focus the input:
```js
useEffect(() => {
inputRef.current.focus();
}, []);
```
-While focused on the input, attempt to scroll down
- observe the bug: the page will scroll when it shouldnt. You can verify this by removing focus from the input and then attempting to swipe again, and it will trigger the handler and prevent scrolling

**Expected behavior**
It should prevent scrolling behavior if I swipe while focused on an input

** Device/Browser **
Safari iOS 17.0

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en la implementación de useSwipeable y sigue cómo se aplica preventScrollOnSwipe mientras un campo de entrada tiene el foco. Reproduce el caso proporcionado en iOS Safari 17.0 y, después, verifica que la página ya no se desplace durante un gesto de deslizamiento sobre un campo de entrada enfocado, mientras se mantiene el comportamiento existente del handler.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
react, typescript
Área
frontend, mobile-dev
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.