fix: nested Block Grid delete navigates to parent block (#312) - #316
Merged
rickbutterfield merged 3 commits intoJul 8, 2026
Merged
Conversation
Bumps the development test site from Umbraco 17.3.4 to 17.5.2 so it exercises the current backoffice, where the nested Block Grid delete regression (#312) reproduces. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…312) Each block preview is rendered inside an <a class="block-preview-edit"> whose href opens that block's edit workspace. When a Block Grid block has areas, Umbraco renders the child block entries - including their action bars - inside that anchor, so a guard cancels the anchor's navigation for action-bar clicks. That guard ran in the bubble phase. Umbraco 17.5 wraps action buttons in umb-block-action, which stops click propagation before it reaches the ancestor anchor, so the bubble guard never ran and its preventDefault never fired. stopPropagation does not cancel the anchor's default navigation, so deleting a child block reloaded the backoffice into the parent block's workspace instead of deleting the child. Add a capture-phase guard on the preview host that cancels the anchor's default navigation for block-action clicks (delete/copy/scale), while letting the edit button through. Capture runs before propagation can be stopped, so it works on 17.5+ and remains correct on earlier versions. The decision is extracted into isBlockActionNavigation() and unit tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…version (#312) The bubble-phase guard in _handleClick duplicated the action-detection logic and had diverged from isBlockActionNavigation: it checked only UUI-ACTION-BAR/UMB-BLOCK-SCALE-HANDLER (missing UMB-BLOCK-ACTION) and used a separate edit-button check. Delegate to isBlockActionNavigation so both the capture- and bubble-phase guards share a single source of truth. The edit button now falls through to the existing link/default handling instead of returning early, which is behaviourally equivalent (nothing is prevented, so navigation proceeds as before). Drop the now-unused UUIButtonElement import and rebuild the bundle. Also revert umbraco-package.json to version 5.5.0-alpha; the previous value (5.5.0--alpha.preview.4.g60bee1c) was an accidentally-committed build-time GitVersioning stamp. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rickbutterfield
added a commit
that referenced
this pull request
Jul 8, 2026
…ete-navigates-parent fix: nested Block Grid delete navigates to parent block (#312)
rickbutterfield
added a commit
that referenced
this pull request
Jul 8, 2026
The index.js/index.js.map from the #316 merge were v5 artifacts and conflicted on cherry-pick. Regenerate them from the merged TypeScript source against v6 (6.1.0-alpha) so the shipped bundle matches the source. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes #312
Problem
Deleting a child element inside a nested Block Grid container reloads the backoffice and opens the parent container's workspace instead of deleting the child. Deleting a top-level block works fine.
Root cause
Each block preview is rendered inside an
<a class="block-preview-edit" href="{block edit route}">. When a Block Grid block has areas, Umbraco renders the child block entries — including their action bars — inside that anchor. A guard cancels the anchor's navigation for action-bar clicks so they don't trigger the parent block's edit route.That guard ran in the bubble phase. Umbraco 17.5 wraps action buttons in
<umb-block-action>, which callsstopPropagation()on the click before it can bubble to the ancestor anchor — so the guard never ran and itspreventDefault()never fired.stopPropagation()does not cancel the anchor's default navigation, so the browser followed the parent block'shref, reloading into the parent workspace.Bisected against Umbraco: reproduces on 17.5.2, works on 17.3.4, with byte-identical BlockPreview click-handling code — i.e. it is triggered by the 17.5 backoffice DOM change, not a BlockPreview regression. (The same code is present on
v5/dev,v6/main, and the released5.4.3, matching the reporter's environments.)Fix
Add a capture-phase guard on the preview host that cancels the anchor's default navigation for block-action clicks (delete / copy / scale), while letting the edit button through so it can still open the block workspace. The capture phase runs before propagation can be stopped, so it works on 17.5+ and remains correct on earlier versions.
The decision is extracted into a pure
isBlockActionNavigation(path)function and unit tested.Testing
nested-block-action-navigation.test.ts(17.5umb-block-actionwrapper, older no-wrapper action bar, plain body click, edit-button exception, scale handle)..NETlibrary builds clean in Release.Notes
🤖 Generated with Claude Code