Skip to content

Page scrolls to top when dragging or resizing #48

Closed
@sebajans

Description

@sebajans

Hey, as the title states i am struggling with this currently. I have a static grid and when resizing the item the page scrolls to the top of the page immediately. What could cause this?

This is my general setup:
Main component:
<Grid rows={20} cols={10} gap={8} class="w-full h-full grid-container z-10" bind:controller={gridController} > {#each items as item, id} <GridTypeItem {item} /> {/each} </Grid>

GridTypeItem component (simplified):
Script:
`function moveStart() {
console.log("moveStart");
document.body.classList.add("disable-selection");
}

function moveEnd() {
console.log("moveEnd");
document.body.classList.remove("disable-selection");
}`

`<GridItem
class="grid-item hover:bg-black/10 transition-colors rounded-md hover:dark:bg-slate-100/10"
id={item.id.toString()}
bind:x={item.x}
bind:y={item.y}
bind:w={item.w}
bind:h={item.h}
on:previewchange={moveStart}
on:change={moveEnd}
previewClass="bg-black/20 rounded-md"

  • Commented content -
`

Is there anything known that could cause this?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions