Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Touch scroll not possible on highlighted area

Aperta
#1,717 5 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia in src/js/components/shepherd-modal.svelte, nei gestori touchmove indicati, e riproduci il problema su shepherdjs.dev con un viewport mobile di piccole dimensioni. Traccia il modo in cui l'area evidenziata e il modal gestiscono touchmove rispetto allo scorrimento con il mouse, quindi verifica che il comportamento di scorrimento tramite tocco segnalato venga corretto o reso configurabile senza compromettere lo scorrimento nell'area oscurata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It is not possible to scroll with touch on the highlighted area or on the modal. However touch scroll on the grayed area and mouse scroll is possible.

Reproduce

This can be tested on shepherdjs.dev:

  1. Open shepherdjs.dev on small mobile device or with dev-tools
  2. Click through the first two steps till you reach the 02. Example section
  3. Try to touch scroll on the code snippet on the example (should not work)
  4. Try to touch scroll on the 01. How to include code snippet (should work)
  5. Try to scroll with mouse wheel (should work)

The default behavior of the touchmove event has been disabled here: https://github.com/shipshapecode/shepherd/blob/99d4f995f79d6bf99ea55c2bd0c62f309f2de968/src/js/components/shepherd-modal.svelte#L90-L92
https://github.com/shipshapecode/shepherd/blob/99d4f995f79d6bf99ea55c2bd0c62f309f2de968/src/js/components/shepherd-modal.svelte#L98-L107

Workaround

I'm currently using this workaround to avoid the call of preventDefault

const allowTouchmove = (event) => {
  event.stopPropagation()
}

const tour = new Shepherd.Tour({
  defaultStepOptions: {
    when: {
      show () {
        const target = this.getTarget()
        if (target) {
          target.addEventListener('touchmove', allowTouchmove)
        }
      },
      hide () {
        const target = this.getTarget()
        if (target) {
          target.removeEventListener('touchmove', allowTouchmove)
        }
      }
    }
  }
})

Suggestion

IMO the preventDefault of the touchmove event should be at least avoidable through the step configuration (something like allowTouchScroll: true).
Also the behavior between mouse scroll, touch scroll on grayed area and touch scroll on highlighted area feels inconsistent and not understandable for a user.

Lingua principale
JavaScript
Stelle
13.8k
Fork
658
Merge medio
7g 5h
PR unite (30g)
18

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di shipshapecode/shepherd

Tutte le issue di shipshapecode/shepherd

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.