Automattic / Automattic/blocks-engine

Anchor-target elements stamped by capture are pruned as empty spans, leaving same-page navigation pointing at nothing

Open
#1,625 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
14
Forks
2
Avg merge
2h 10m
Merged PRs (30d)
561

Description

## Problem

In-page navigation on an imported Wix site points at nothing. The menu's "Contact" item links to `/#Contact%20Us`, the link is faithfully preserved, but no element in the compiled page carries that id, so clicking does nothing. On the source site it scrolls to the contact section.

Observed on an import of `https://www.kdclegal.com/` (Wix, 65 routes) via `studio create --from`, blocks-engine trunk @ `671db300` + static-site-importer v1.9.2 @ `7f51247`.

## Evidence

The capture does its part. Data Liberation stamps an explicit anchor target in the captured HTML:

```html

```

The compiled homepage keeps three references to it and zero targets:

- `href="http://localhost:8897/#Contact%20Us"` (desktop nav)
- `href="http://localhost:8897/#Contact%20Us--dla-mobile"` (mobile nav variant)
- `id` search across the rendered page: no element with `Contact` in its id, no `data-dla-anchor-target` anywhere.

The stamped span is empty and invisible, which makes it look like safe dead markup to prune. It is load-bearing.

## Expected

An element that is the target of a same-document anchor survives conversion. The WordPress-native shape is to project the captured id onto the nearest generated block's `anchor` attribute (Gutenberg's "HTML anchor"), which also makes the target user-visible and editable in the inspector. Preserving the bare span would also do.

## Side observation

One nav variant on the same page kept an unrewritten absolute source URL: `href="https://www.kdclegal.com#Contact%20Us"`. A visitor clicking it leaves the imported site for the live Wix site. Possibly a separate URL-rewrite gap; noting it here for triage.

## Reproduction

Import `https://www.kdclegal.com/`, open the homepage, click "Contact" in the header. Compare with the source site. Or:

```js
document.querySelectorAll('[id*="Contact"]').length // 0 after import
```

Found while working the Wix migration gap list (run report: kdclegal, 7 Sep 2026).

Contributor guide

Open the contributing guide

Research direction

Start with the capture-to-block conversion path exercised by `studio create --from`, then trace how empty stamped spans are pruned. Reproduce the `kdclegal.com` import and verify that same-document links such as `#Contact%20Us` have a surviving target in the compiled homepage, without relying on the separate absolute-URL observation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.