Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Accordion items whose own element is the disclosure control are not recognized

Closed
#3,049 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.