Skip to content

fix: close the block hover toolbar after a drag-reorder - #196

Merged
StephenTangCook merged 1 commit into
mainfrom
claude/block-reorder-focus-menu-11f1c4
Aug 17, 2026
Merged

fix: close the block hover toolbar after a drag-reorder#196
StephenTangCook merged 1 commit into
mainfrom
claude/block-reorder-focus-menu-11f1c4

Conversation

@StephenTangCook

@StephenTangCook StephenTangCook commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The per-block hover toolbar stayed open after a drag-reorder, following you around while you moved the pointer over other blocks. It now hides on pointer-out like it should, while keyboard Tab still reveals it.

Why

Pressing a block to drag it leaves DOM focus on that block. The toolbar was revealed by group-focus-within, so after release the focused block kept its toolbar pinned open until you clicked somewhere else.

:has(:focus-visible) ignores pointer focus but still matches Tab-stops, which is the only case that branch existed for (so the floating buttons stay visible while tabbing through them). Same one-line change in BlockRow and ContainerRow.

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test (46 files, 526 tests)
  • Spot-checked in the demo app

Manual verification in the demo:

  • Press-drag a block, release, move the pointer to another block: only the hovered block toolbar is visible. Confirmed in the DOM that document.activeElement is still the dragged block while its toolbar computes to opacity: 0.
  • With the pointer parked off the canvas, Tab onto a toolbar button: that row toolbar computes to opacity: 1 and the button matches :focus-visible.

Notes for reviewer

No onDragEnd blur call was added. The CSS variant covers it, so there is nothing to keep in sync with the dnd-kit lifecycle.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Pressing a block to drag it leaves DOM focus on that block, so the
`:focus-within` reveal kept its hover toolbar pinned open after release
even while the pointer moved on to other blocks. It only cleared on a
click elsewhere.

Reveal on `:has(:focus-visible)` instead, which ignores pointer focus but
still matches Tab-stops, the only case that branch existed for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

✅ Deployed 479ffcd · Branch preview · Commit preview · Build logs

@StephenTangCook
StephenTangCook merged commit ccbd968 into main Aug 17, 2026
14 checks passed
@StephenTangCook
StephenTangCook deleted the claude/block-reorder-focus-menu-11f1c4 branch August 17, 2026 20:09
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