fix(migrate/extract): detect header/footer on sites without semantic tags (VTEX IO) - #212
Merged
Merged
Conversation
…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>
Merged
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.
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>):[class*=header]container)[class*=footer]region with ≥4 links, or a bottom full-width block with ≥6 linksShared by
extract+migrate.Verification
Full suite green (1100), tsc + biome clean, build OK. Live
electrolux.com.ecnow 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
collectCandidatesInPageto infer header from the top-most full-width ancestor ofnav, logo, or search, or a top[class*=header]container.[class*=footer]with ≥4 links, or a bottom full-width block with ≥6 links.extractandmigrate. Single-file change:src/extract/detect-components.ts(+64).Rollout
electrolux.com.ec: global header/footer now detected. Test suite and build are green.Written for commit 4c9e2b7. Summary will update on new commits.