Repository navigation
[accordion] Fix Trigger data-value and data-index attributes - #5705
Merged
Merged
Conversation
cpruijsen
requested review from
atomiks,
colmtuite,
flaviendelangle,
jjenzz and
michaldudak
as code owners
September 11, 2026 07:38
commit: |
Bundle size
PerformanceTotal duration: 1,066.75 ms -202.78 ms(-16.0%) | Renders: 76 (+0) | Paint: 1,726.93 ms -304.98 ms(-15.0%)
11 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Accordion.Triggernow usesaccordionStateAttributesMapping(value: () => null,index: String(value)), same as Item, Header, and Panel, and overlaystriggerOpenStateMappinglast soopenstaysdata-panel-open. Triggers no longer render the root's open-values array asdata-value="a,b", and they emitdata-indexon every trigger, including"0".Fixes #5644
Trigger passed the full item state into
useRenderElementwith onlytriggerOpenStateMapping. Unmapped keys go throughgetStateAttributesProps, which writesdata-<key>for any truthy value and drops falsy ones, so the first item (index === 0) had nodata-index.Decision
Emit
data-indexon every trigger, including"0", and dropdata-value, matching Item/Header/Panel. The alternative is to suppressdata-indexon Trigger as well (index: () => null) so only the documented Trigger attributes remain. Issue #5644 asked fordata-indexon every trigger or on none, and the other accordion parts already always stringify index.Can switch to omitting
data-index, or add it toAccordionTriggerDataAttributes/ the Trigger docs table.Left alone (same as Item/Header today, and listed on the issue as optional extras): undocumented
data-hidden, anddata-orientationfrom the deprecated orientation prop.Test plan
Accordion.Triggerdoes not renderdata-valuewhen the rootvalueis['a', 'b']data-index="0"on the first trigger anddata-index="1"on the seconddata-panel-openand notdata-open108passed,15skipped)