fix: close the block hover toolbar after a drag-reorder - #196
Merged
Conversation
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>
Contributor
Cloudflare preview✅ Deployed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inBlockRowandContainerRow.Test plan
pnpm typecheckpnpm lintpnpm test(46 files, 526 tests)Manual verification in the demo:
document.activeElementis still the dragged block while its toolbar computes toopacity: 0.opacity: 1and the button matches:focus-visible.Notes for reviewer
No
onDragEndblur 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
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.