Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Los eventos táctiles no se activan en los bordes de los elementos en iOS Safari

En los dispositivos táctiles, los siguientes eventos se activan al tocar un elemento:

  • Inicio táctil
  • punto de contacto
  • ratónenter
  • ratón hacia abajo
  • ratón arriba
  • hacer clic

Los eventos mouseenter, mousedown, mouseup y click son emulados por el evento touchend. Si desea deshabilitar esta emulación de eventos del mouse, puede usar preventDefault().

Pero si en iOS Safari toco los bordes de un elemento, se desencadenan los siguientes eventos:

  • ratónenter
  • ratón hacia abajo
  • ratón arriba
  • hacer clic

De alguna manera, los eventos táctiles no se activan en los bordes y, por eso, tampoco puedo usar preventDefault() para detener la emulación de los eventos del mouse.

El problema ocurre tanto en iPhone como en iPad.

Busqué Stack Overflow y Google, pero no puedo encontrar nada al respecto. Sin errores y sin soluciones. ¿Alguien sabe si se trata de un error conocido en Safari?

Creé el código más básico para reproducir este error en JSFiddle :

HTML:

 <div id="element"></div> <div id="log"></div>

CSS:

 #element { height: 100px; width: 100px; background: yellow; margin: 20px; }

JavaScript:

 function handler(event) { const log = document.getElementById('log'); log.innerHTML = `${event.type}<br />${log.innerHTML}`; } const element = document.getElementById('element'); element.addEventListener('mouseenter', handler); element.addEventListener('mouseleave', handler); element.addEventListener('mousedown', handler); element.addEventListener('mouseup', handler); element.addEventListener('click', handler); element.addEventListener('focus', handler); element.addEventListener('blur', handler); element.addEventListener('touchstart', handler); element.addEventListener('touchend', handler);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intente adjuntar el detector de eventos al elemento más externo, la etiqueta html.

Ver más: https://www.tutorialrepublic.com/javascript-tutorial/javascript-event-propagation.php

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!