Skip to content

fix(content): keep a collapsed FAQ's answers when URL import finds it next to the post body - #1405

Merged
gkhngyk merged 1 commit into
mainfrom
fix/import-collapsed-faq
Oct 23, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/import-collapsed-faq

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Summary

URL import (Content Editor › New content › Optimize › Page URL) dropped the answers of a collapsed FAQ that sits next to the post body rather than inside it.

Why it happened. server/src/lib/page-content.js picks the post body as the text area and removes hidden blocks outside it. In the common layout, <main> holds the post body and then an FAQ section, so the FAQ's questions came through and its hidden answers didn't.

The fix. A hidden block right after a heading (h2–h6) is an accordion's answer, so it no longer goes with the other hidden blocks.

  • It waits until the root is known, and is kept when it sits inside the root.
  • Other hidden blocks outside the text, such as menus, banners and newsletters, are still removed.
  • Blocks with hidden="until-found" work as before.

Tests. A new test in page-content.test.js covers a post followed by an FAQ section:

  • both answers (hidden and display:none) come through;
  • a hidden cookie banner and a hidden newsletter block are still dropped.

The test fails without the change.

Related issue

Closes #1381

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. In Content Editor › New content › Optimize › Page URL, import a post with a collapsed FAQ after its body.
  2. The draft has each question with its answer under it.

Server: npm run format && npm run lint && npm test (2,128 tests) pass.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): no web change
  • yarn typecheck passes (run from web/): no web change
  • yarn format:check passes (run from web/): no web change
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

… next to the post body

URL import removes what a page hides outside the text area, which is right
for menus and banners. A common layout puts a collapsed FAQ after the post
body, still inside the page's main block. Its questions came through, and
its hidden answers didn't.

A hidden block right after a heading (h2 to h6), the accordion's shape, now
waits until the root is known. It is kept when it sits inside the root,
and removed otherwise. Other hidden blocks outside the text are still
removed, and blocks hidden until found work as before.

Closes #1381
@gkhngyk
gkhngyk merged commit b709c38 into main Oct 23, 2026
6 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.

fix(content): keep a collapsed FAQ's answers when URL import finds it next to the post body

1 participant