Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#3,049 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PHP
Stelle
22
Fork
2
Merge medio
8h 12m
PR unite (30g)
679

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Automattic/blocks-engine

Tutte le issue di Automattic/blocks-engine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.