bounds='parent' moves draggable component to get stuck in y axis
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, next.js, react
- Ambito
- frontend
Direzione di ricerca
Start with the reported Draggable example using bounds='parent', axis='both', and the handle selector, then inspect how the App, Sidebar, and Component nesting affects the resolved parent. Reproduce the snap and x-axis behavior in the provided Next.js structure. Done means bounds use the intended container rather than the higher-level Sidebar and movement remains possible on both axes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Repro:
Using Next.Js - importing : import Draggable, {DraggableCore} from 'react-draggable';
<div className='border bg-gray-100 h-96'>
<Draggable
handle=".draggable"
onDrag={eventControl}
onStart={eventControl}
bounds='parent'
axis='both'
onStop={eventControl}
// bounds={{left: 0, top: 0, right: 100, bottom: 350}}
>
<div className="draggable" id='item'>
<BsArrowReturnLeft size={30}></BsArrowReturnLeft>
</div>
</Draggable>
</div>
When I console log the parent node: console.log(document.getElementById('item').parentNode);
I get this component with classname <div className='border bg-gray-100 h-96'> which is correct.
However, the draggable arrow snaps to the right side of the screen (not the parent), and won't move along the x axis. It should not snap past the parent, and it should move along both axis.
UPDATE
The issue here is that the Draggable component is being snapped to the parent - which would be the Sidebar, as this is the strict 'parent' wrapping all children in my react application:
export default function App({Component, pageProps}) {
return (
<div>
<Sidebar>
<Component {...pageProps} />
</Sidebar>
</div>
);
}
So the question is - how do I bound the draggable component to a specific HTMLElement, i.e. the immediate parent, the container, rather than the top level parent?
I am assuming this is the issue here.
- Lingua principale
- JavaScript
- Stelle
- 9.3k
- Fork
- 1k
- Merge medio
- 2g 16h
- PR unite (30g)
- 5
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react-grid-layout/react-draggable
-
bug ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
react-grid-layout/react-draggable#822 · 1 commento ·
-
bug needs-info
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
react-grid-layout/react-draggable#782 · 2 commenti ·
-
bug needs-info
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
react-grid-layout/react-draggable#772 · 1 commento ·
-
error in react 19Apertabug ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
react-grid-layout/react-draggable#771 · 14 commenti · 31 reazioni ·
-
enhancement ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
react-grid-layout/react-draggable#762 · 1 commento ·
Tutte le issue di react-grid-layout/react-draggable
Issue simili
-
bug CI breakage triage needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
oppia/oppia#27517 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
draftomen enhancement size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
andreagrandi/draftomen#761 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
HarperFast/harper#2866 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
HarperFast/harper-pro#927 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
anthropics/skills#1897 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno