Skip to content

fix(migrate/extract): detect header/footer on sites without semantic tags (VTEX IO) - #212

Merged
JonasJesus42 merged 1 commit into
mainfrom
migrate-component-detection-vtex
Aug 17, 2026
Merged

fix(migrate/extract): detect header/footer on sites without semantic tags (VTEX IO)#212
JonasJesus42 merged 1 commit into
mainfrom
migrate-component-detection-vtex

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

From your report that header/footer weren't being found.

Root cause (probe of electrolux.com.ec): the DOM has 0 <header>, 0 <footer>, 0 [role=banner], 0 [data-section] — VTEX IO renders both as plain <div>s, so the semantic-tag detector found neither.

Fix: a geometry/anchor fallback in collectCandidatesInPage, firing only when nothing semantic matched (no regression for sites with real <header>/<footer>):

  • header = the top-most full-width ancestor of the nav/logo/search (or a top [class*=header] container)
  • footer = the bottom full-width [class*=footer] region with ≥4 links, or a bottom full-width block with ≥6 links

Shared by extract + migrate.

Verification

Full suite green (1100), tsc + biome clean, build OK. Live electrolux.com.ec now detects global/header + global/footer (+ minicart) where it previously found neither.

Next

The natural follow-up is linking each detected component ↔ its VTEX block ↔ content (using the block tree as the primary source for VTEX). Happy to do that next.

Off main.

🤖 Generated with Claude Code


Summary by cubic

Detects header and footer on VTEX IO and other sites without semantic tags. Previously we only matched <header>, <footer>, [role=banner], or [data-section]; now a geometry/anchor fallback runs when none are present, without changing behavior on semantic sites.

Review

  • Adds a fallback in collectCandidatesInPage to infer header from the top-most full-width ancestor of nav, logo, or search, or a top [class*=header] container.
  • Infers footer from a bottom full-width [class*=footer] with ≥4 links, or a bottom full-width block with ≥6 links.
  • Executes only when semantic detection finds no header/footer; shared by extract and migrate. Single-file change: src/extract/detect-components.ts (+64).

Rollout

  • No migration required.
  • Verified on electrolux.com.ec: global header/footer now detected. Test suite and build are green.

Written for commit 4c9e2b7. Summary will update on new commits.

Review in cubic

…tags (VTEX IO)

Component detection only found header/footer via `<header>`/`<footer>`/
`[role=banner]`. VTEX IO (and some custom sites) render both as plain `<div>`s,
so header/footer were never detected — a probe of electrolux.com.ec showed
0 `<header>`, 0 `<footer>`, 0 `[data-section]` in the DOM.

Added a geometry/anchor fallback in `collectCandidatesInPage`, firing ONLY when
nothing semantic matched (so it can't regress sites that use semantic tags):
- header = the top-most full-width ancestor of the nav/logo/search (or a top
  `[class*=header]` container).
- footer = the bottom full-width `[class*=footer]` region with ≥4 links, or a
  bottom full-width block with ≥6 links.

Shared by `extract` and `migrate`. Full suite green (1100), tsc + biome clean,
build OK. Live electrolux.com.ec now detects global/header + global/footer
(+ minicart) where it previously found neither.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JonasJesus42
JonasJesus42 merged commit 97ea3b2 into main Aug 17, 2026
2 checks passed
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