Prevent default action only if event is cancelable#42
Open
jelowin wants to merge 2 commits into
Open
Conversation
…-touchmove Prevent default action only if event is cancelable
|
@jelowin is attempting to deploy a commit to the midudev's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🚀 Fix: Evitar intervención del navegador en eventos táctiles del Slider
📝 Descripción
Este PR corrige un error recurrente de Intervención del Navegador (Browser Intervention) que se genera al interactuar con el componente react-slidy en dispositivos móviles o emuladores táctiles.
El navegador (especialmente Chrome) bloquea de forma unilateral los intentos de cancelar el scroll mediante JavaScript si la página ya ha iniciado el movimiento, arrojando el siguiente error en la consola:
Intervention: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
🛠️ Problema Técnico
En el archivo slidy.js (línea 166), la librería ejecuta un e.preventDefault() de forma incondicional dentro del manejador del evento touchmove para intentar bloquear el scroll vertical mientras se arrastra el carrusel.
Sin embargo, si el usuario ya ha empezado a mover la pantalla, el navegador marca internamente el evento como no cancelable (e.cancelable = false). Al intentar forzar el preventDefault() sobre un evento que ya no se puede cancelar, el navegador ignora la instrucción y lanza una excepción en la consola, afectando negativamente a las métricas de rendimiento y experiencia de usuario.
💡 Solución Aplicada
Dado que las reglas de CSS (touch-action) no son suficientes para mitigar este comportamiento debido a la prioridad que toma el hilo principal del navegador, se ha optado por cambiar la logica del JS.
Screen.Recording.2026-05-21.at.12.30.40.mov