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

223
Views
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
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!