bounds='parent' moves draggable component to get stuck in y axis
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 45/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- javascript, next.js, react
- Domínio
- frontend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 9.3k
- Forks
- 1k
- Merge médio
- 2d 16h
- PRs com merge (30d)
- 5
Preparar o ambiente
Ainda não verificamos os arquivos de configuração deste projeto. Comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de react-grid-layout/react-draggable
-
bug ready-for-agent
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
react-grid-layout/react-draggable#822 · 1 comentário ·
-
bug needs-info
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
react-grid-layout/react-draggable#782 · 2 comentários ·
-
bug needs-info
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
react-grid-layout/react-draggable#772 · 1 comentário ·
-
error in react 19Abertabug ready-for-agent
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
react-grid-layout/react-draggable#771 · 14 comentários · 31 reações ·
-
enhancement ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 45/100
react-grid-layout/react-draggable#762 · 1 comentário ·
Todas as issues de react-grid-layout/react-draggable
Issues semelhantes
-
bug CI breakage triage needed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
oppia/oppia#27517 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
draftomen enhancement size: S
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
andreagrandi/draftomen#761 ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
HarperFast/harper#2866 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
HarperFast/harper-pro#927 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
anthropics/skills#1897 · 1 comentário ·
Mantenedores costumam responder em até 1 dia