Skip to content

fix: (legacy version) fix utils used for calculating scroll offsets inside of iframes#2017

Open
istateside wants to merge 2 commits intoclauderic:masterfrom
istateside:kf/fix-scroll-offsets-in-iframes
Open

fix: (legacy version) fix utils used for calculating scroll offsets inside of iframes#2017
istateside wants to merge 2 commits intoclauderic:masterfrom
istateside:kf/fix-scroll-offsets-in-iframes

Conversation

@istateside
Copy link
Copy Markdown

@istateside istateside commented Apr 16, 2026

This PR is for the legacy version of the library - i'm not sure if you're still accepting patches for the @dnd-kit/core and @dnd-kit/utilities libraries, but these were blocking bugs for me

I noticed that scroll offsets are not calculated correctly when the draggable nodes are in a different frame than the execution context.

getScrollableElement was returning window directly instead of fetching the correct window object off of the element argument
and getWindow was not properly handling the case where the given target element was a Document object from inside of an iframe, which can be the case if the iframe document has no scrollable element beyond the html node

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: 94128e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@dnd-kit/core Patch
@dnd-kit/utilities Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@istateside istateside marked this pull request as ready for review April 27, 2026 18:32
}

return target.ownerDocument?.defaultView ?? window;
let ownerDoc = target.ownerDocument;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handles when target is the Document object itself

@istateside istateside changed the title fix: fix utils used for calculating scroll offsets inside of iframes fix: (legacy version) fix utils used for calculating scroll offsets inside of iframes Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant