bounds='parent' moves draggable component to get stuck in y axis
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- javascript, next.js, react
- Domaine
- frontend
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- JavaScript
- Étoiles
- 9.3k
- Forks
- 1k
- Merge moyen
- 2 j 16 h
- PR mergées (30 j)
- 5
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de react-grid-layout/react-draggable
-
bug ready-for-agent
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
react-grid-layout/react-draggable#822 · 2 commentaires ·
-
V4.5.0 Chrome Extension ErrorOuvertebug needs-info
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
react-grid-layout/react-draggable#782 · 2 commentaires ·
-
bug needs-info
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
react-grid-layout/react-draggable#772 · 1 commentaire ·
-
error in react 19Ouvertebug ready-for-agent
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
react-grid-layout/react-draggable#771 · 14 commentaires · 31 réactions ·
-
enhancement ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
react-grid-layout/react-draggable#762 · 1 commentaire ·
Toutes les issues de react-grid-layout/react-draggable
Issues similaires
-
Design only Leadership Survey SLFS
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
bcgov/digital-journeys#2293 ·
-
Toolkit
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
API Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
ProjectSidewalk/SidewalkWebpage#5556 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
jessepollak/home#1454 ·
Les mainteneurs répondent en général sous 1 jour
-
Mend: dependency security vulnerability untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
opensearch-project/OpenSearch-Dashboards#12822 ·
Les mainteneurs répondent en général sous 1 jour