Jittery movement when draggable uses nodeRef, smooth movement when using handle

Aperta
#761 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with the nodeRef example in the README and reproduce the jitter by wrapping the referenced header in a div. Compare that behavior with the handle approach, then verify that dragging remains smooth with the wrapper and nodeRef while avoiding the findDOMNode warning.

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

Descrizione

Looks like nodeRef causes jittery movement when the handle is not a direct ancestor. For example, using the nodeRef example from the README and adding a div wrapping the target causes this issue.

We're updating draggable modal windows to use nodeRef props to avoid the console warning about findDOMNode being deprecated. Previously, we had handle set to a DOM class name and that exact class name assigned to an element inside the element.

<Draggable nodeRef={dragRef}>
  <div>
     <header className={clsx(styles.header, styles[uiVariant])} ref={dragRef}>/* content */</header>
  </div>
</Draggable>

chrome_JpWDOI93H2

With the handle approach, the movement when dragging and item was smooth and we had no issues. With the nodeRef, it's incredibly jittery. We normally have bounds and onDragStart methods but I removed those for testing and the jitter persists.

Lingua principale
JavaScript
Stelle
9.3k
Fork
1k
Merge medio
3g 8h
PR unite (30g)
4

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 react-grid-layout/react-draggable

Tutte le issue di react-grid-layout/react-draggable

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.