[Suggestion] Replace `getBoundingClientRect()` with `IntersectionObserver` in `attachClosestEdge()`

Author: rose-bouchayerCreated Aug 4, 2026Updated Aug 4, 2026

While walking through the source code of the packages, I noticed that attachClosestEdge() is using getBoundingClientRect(). This method triggers reflow (aka layout trashing) which are known to be a performance bottleneck and that can be avoided by using the IntersectionObserver API.

See What forces layout / reflow and Avoid large, complex layouts and layout thrashing for resources on the subject.

Note : I've not noticed any direct performance bottleneck from pragmatic-drag-and-drop, this is a just a potential improvement to the lib.

The fact that attachClosestEdge() is called inside onDrag() event means the reflow can quickly be triggered a lot of time and may cause a performance bottleneck.

I hadn't found the time to make a repro with a custom attachClosestEdge() function using IntersectionObserver, might try to do that later on.

Source: atlassian/pragmatic-drag-and-drop