Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
iOS prevent selection of entire paragraph on long press Vue JS touchhold event

I'm using the vue-touch-events touchhold function to build a "peek" feature for a iOS & Android app that I'm working on, built using Capacitor JS

The app works well, but there doesn't seem to be a core plugin listed for creating a "peek" feature (where the user long taps and then the phone vibrates and some text appears)

I've got this part woking, but my issue is that on a physical device, on iOS, the long press (touchhold) event is triggering a selection of the text, that's the iOS selection box that's blue and allows a user to choose things such as: copy, paste etc...

I've added the following to my component that wraps the text and/or button that needs to be peeked:

<template>
  <div
    unselectable="on"
    onselectstart="return false;"
    v-touch:touchhold="peek"
    onmousedown="return false;"
    class="tw-select-none">
    <slot name="activator"></slot>
  </div>
</template>

I'm using Tailwind CSS, but have tried the following:

  • user-select: none is already applied
  • onmousedown is set to return false
  • onselectstart is set to return false
  • unselectable is set to on
  • I have some custom CSS for selections (which makes no difference) set as:
::selection,
::-moz-selection,
::-webkit-selection {
    background: #000;
    color :#fff;
}

Despite all this, I still get the annoying iOS selection box over everything, how can I disable this? Or work around this? Maybe make it transparent somehow?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda