Accordion items whose own element is the disclosure control are not recognized
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start with AccordionPattern::isDisclosureTitle(), disclosureControlElement(), and allDisclosureItemElements(), which the issue identifies as rejecting controls placed on the item element. Trace how hasAccordionSignal() and HtmlTransformer::transform() handle the reduced fixture. Done means the fixture produces one core/accordion with two items, closed by default, panels inside core/accordion-panel, and no core/html.
Written by the indexing model from the issue text.
Description
Problem
A captured click-to-expand list where the item itself is the control (the whole row is clickable, so capture marks the item with aria-controls / aria-expanded and its answer panel with data-blocks-engine-capture-local-disclosure) is not recognized as an accordion. On a real FAQ the hidden answer panels become core/html islands and the import fails its quality gate ("4 core_html_block failures"); answers are visible on load and do not toggle.
The same markup with a <button aria-controls> wrapping the question converts to native core/accordion.
Reduced fixture
<style>.hidden{display:none}</style>
<section><h2>FAQ</h2><div class="list">
<div class="faq-item" aria-controls="p0" aria-expanded="false" tabindex="0">
<div class="row"><h3>Question 0?</h3><span class="faq-icon">+</span></div>
<div class="faq-answer hidden" id="p0" role="region" data-blocks-engine-capture-local-disclosure="true" hidden><p>Answer 0.</p></div>
</div>
<div class="faq-item" aria-controls="p1" aria-expanded="false" tabindex="0">
<div class="row"><h3>Question 1?</h3><span class="faq-icon">+</span></div>
<div class="faq-answer hidden" id="p1" role="region" data-blocks-engine-capture-local-disclosure="true" hidden><p>Answer 1.</p></div>
</div>
</div></section>
HtmlTransformer::transform() on trunk (354dfdf3d + open PRs):
| control placement | core/accordion | core/details | core/html |
|---|---|---|---|
item div carries aria-controls (above) |
0 | 0 | 0 (panel lowered to a layout shell, control semantics dropped) |
<button aria-controls> around the <h3> |
7 blocks | 0 | 0 |
On the full artifact the panels (which also carry data-blocks-engine-capture-disclosure-open-class / -closed-class) become core/html.
Cause
AccordionPattern only finds disclosure controls at or below the title: isDisclosureTitle() / disclosureControlElement() look at the <h3>, and allDisclosureItemElements() therefore rejects the list. The item element's own aria-controls, which names a panel inside that item, is never considered. Without a faq/accordion class on the list root, hasAccordionSignal() also fails.
Expected
An item element whose aria-controls names a panel it contains is a disclosure item: its title is the heading inside it, its panel is the controlled element, and aria-expanded on the item decides openByDefault. The fixture converts to one core/accordion with two items, answers inside core/accordion-panel, closed by default, and no core/html.
Source
Captured with data-liberation-agent#905 (non-ARIA onclick accordions captured as local disclosures, Automattic/data-liberation-agent#901) from a production FAQ (<div class="faq-item" onclick="toggleFaq(this)">).
Filed by Franklin (Claude Opus via Pi coding agent) on behalf of @chubes4. Root cause traced with a reduced fixture through HtmlTransformer; AI drafted this issue.
- Dominant language
- PHP
- Stars
- 21
- Forks
- 2
- Avg merge
- 8h 50m
- Merged PRs (30d)
- 609
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/blocks-engine#3090 ·
Maintainers usually reply within 1 day
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#2061 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#1701 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 3 days
-
Перевод устарел
Difficulty 1/5 Under an hour Newbie friendliness 74/100