Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda