Skip to content

test(browser): let dnd-kit see its first resize before text shrinks - #1150

Merged
kalvinnchau merged 1 commit into
mainfrom
larry/group-drag-resize-race
Oct 15, 2026
Merged

kalvinnchau merged 1 commit into
mainfrom
larry/group-drag-resize-race

Conversation

@loganj

@loganj loganj commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

🤖

Summary

  • Fixes a WebKit failure on main (e10c4ee, run 38652866838) in the sidebar test that drags one group's header onto another while the text size changes. After the text shrank, the pointer sat over the target group's new header, but the drop line never showed up.
  • This is a test timing race. The app behavior is fine. The test now waits for one browser rendering update before it shrinks the text.

Details

  • The sidebar uses dnd-kit (the drag-and-drop library) to find which group is under the pointer. dnd-kit measures each group when a drag starts. After that, it measures a group again only when that group's ResizeObserver (a browser callback that fires when an element changes size) reports a resize. It starts these observers at drag start and ignores their first callback, because that callback only reports the starting size.
  • The test shrank the text about 10 ms after the drop line first appeared. On a slow WebKit runner, the browser did not render a frame between drag start and the text change. So the starting size and the resize came in one callback. dnd-kit ignored that callback, kept the measurements taken at the large text size, and the pointer never hit a group.
  • The test now waits two animation frames before it changes the text. Browsers deliver ResizeObserver callbacks during each rendering update, so the starting-size callback comes first and the text change comes in a separate callback. A real user cannot change the text size within one frame of starting a drag, so this does not hide a product bug.
  • Local reproduction: I wrapped ResizeObserver to hold callbacks from drag start through the text change, then sent one callback per observer. That gave the same CI failure (data-drop-edge stayed null at the same assertion). When I sent the held callback before the text change, the test passed.

The group drag text-size test changed the root font size right after the
drop edge appeared. dnd-kit starts each droppable's ResizeObserver when a
drag starts and ignores the first notification as the initial size. On a
slow WebKit runner no rendering update ran between drag start and the
text change, so both arrived as one notification. dnd-kit ignored it, kept
the 32px rects, and the pointer over Unavailable's new header never hit.

Wait two animation frames before shrinking the text so the initial
notification is delivered on its own. Holding ResizeObserver delivery
across the change reproduces the CI failure locally; releasing it before
the change passes.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <[email protected]>
@loganj
loganj marked this pull request as ready for review October 15, 2026 00:02
@loganj
loganj requested a review from a team as a code owner October 15, 2026 00:02

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 LGTM. Verified against @dnd-kit/core 6.3.1 useDroppable: handleResize drops the first ResizeObserver callback after observe(), so a coalesced initial+resize notification loses the remeasure. Double rAF guarantees one rendering update (and its RO delivery) before the font-size change. Matches the existing pattern in tests/browser/appearance.spec.mjs. Test-only change; CI green.

@kalvinnchau
kalvinnchau merged commit 0a2325c into main Oct 15, 2026
60 of 63 checks passed
@kalvinnchau
kalvinnchau deleted the larry/group-drag-resize-race branch October 15, 2026 00:07
johnmatthewtennant added a commit that referenced this pull request Oct 15, 2026
…-drag

* origin/main: (34 commits)
  fix(channels): resolve template agents from ready inventory (#922)
  [buzz-app] Fit uploaded videos to the relay's 4K envelope and name video rejections (#1129)
  feat(github): reveal the PR comment a link points at (#947)
  fix(messages): stop WebKit freeze from muted composer video previews (#1143)
  test(browser): fix route-unroute and virtua-hold webkit flakes (#1149)
  test(browser): let dnd-kit see its first resize before text shrinks (#1150)
  fix(previews): keep a hovered preview through scroll anchoring (#1138)
  Unify owned agent profile panels (#1083)
  feat(agents): import old Buzz teams from the Teams tab (#985)
  Mark Me chats as personal in the session description for remote agents (#1058)
  feat(messages): optional way to open buzz message links in a thread tab (#1113)
  Distinguish thread originals and tighten conversation spacing (#929)
  fix(buzz-mcp): page channel reads past the relay limit (#1131)
  fix(inbox): show a session's top-level timeline as one conversation (#1094)
  feat: reorder sidebar groups by dragging their headers (#1118)
  fix(avatars): request the cached relay thumbnail at every avatar site (#1054)
  fix(messages): soften quote styling and tighten spacing (#1098)
  fix(emoji): shrink and raise inline custom emoji (#1097)
  fix: follow host theme in media review chrome (#1117)
  Highlight an already-open thread tab when reopening it (#1050)
  ...

Signed-off-by: John Tennant <[email protected]>
Co-authored-by: Claude Worker <f425b86c3b780d43f8d9cf1802429d04dd985bf92eac44fca9468b5ad3887c5e@buzz.block.builderlab.xyz>

# Conflicts:
#	src/features/channel-navigation/ChannelSidebarDnd.tsx
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.

2 participants