Restate an accordion trigger's box that core cannot save - #1872
Merged
Merged
Conversation
core/accordion-heading saves its own `<button>` with a fixed class and no others, so a source trigger's classes are dropped and every author rule addressing them is left with nothing to match. A trigger that stated its own vertical padding collapsed onto the destination theme's defaults and every row in the accordion lost that height — an imported FAQ ran 70px short of its source at every viewport. Carry the resolved trigger box as generated CSS keyed on a marker the heading holds, the way core/details already restates its summary. Attributes cannot go on the toggle itself: that would diverge from core's save shape and invalidate the block. The declaration side is shared with the details path, which resolved the same problem for the same reason.
This was referenced Sep 16, 2026
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.
Problem
core/accordion-headingsaves its own toggle with a fixed class and nothing else:A source trigger's classes are therefore dropped, and every author rule addressing them is left with nothing to match. A trigger that stated its own vertical padding collapses onto the destination theme's defaults:
py-4is 16px top and bottom. Losing it cost ~14px per row, and an imported five-row FAQ ran 70px short of its source at every viewport — the single remaining geometry gap on the site this was found on, at both 1440px and 390px.Fix
Carry the resolved trigger box as generated CSS keyed on a marker the heading holds:
Attributes cannot go on the toggle itself — that would diverge from core's save shape and invalidate the block.
core/detailsalready resolved the same problem for the same reason (disclosureSummaryMarker), so the declaration side is shared rather than duplicated:disclosureControlCarriedCss()now serves both, and the two callers differ only in their selector and marker prefix.Triggers resolving to the same box share one marker and emit one rule. A trigger with no resolved box of its own carries no marker.
Verification
Re-imported the source site and measured every section against it.
1440px — total page height 5360 vs 5360, delta 0:
390px — all seven sections match on height and offset.
Every section now matches on both height and y-offset at both viewports. Import stays clean: quality pass, 0 fallbacks, 0 invalid blocks.
tests/unit/accordion-toggle-presentation.php— 9 assertions covering the marker, core's save shape staying byte-exact, marker reuse, rule de-duplication, and an unmarked bare trigger.tests/unit/closed-details-fixed-overlay.phpstill green, covering the shared declaration path.composer test:canonical,composer test:parity(311 fixtures),composer test:packagingall green.Follow-up, not in scope
Core renders the toggle icon as a
+glyph where the source used a chevron SVG. That is a core-owned glyph inside a now-correct box, and is worth handling separately.AI assistance disclosure
Investigated and implemented with Claude Sonnet 4.6 via opencode. The model measured imported-versus-source section geometry with Playwright to isolate the 70px gap to the accordion trigger, found the existing
core/detailsprecedent, then wrote the fix and its tests. All output was reviewed before submission.