refactor(aria/accordion): simplify code by using template references instead of user id to match panels with triggers#32855
Open
adolgachev wants to merge 1 commit intoangular:mainfrom
Open
Conversation
d4b9a3c to
6202429
Compare
|
Deployed dev-app for 7a691f5 to: https://ng-dev-previews-comp--pr-angular-components-32855-dev-o5cstcah.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
6202429 to
26db0a8
Compare
|
Deployed docs-preview for 7a691f5 to: https://ng-dev-previews-comp--pr-angular-components-32855-docs-3p0wfv7f.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
6881f1d to
bc23c8a
Compare
4ae78eb to
feac17f
Compare
21ea60e to
5c931a4
Compare
05bbfab to
7077bfb
Compare
…instead of user id to match panels with triggers
7a691f5 to
fc055d5
Compare
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.
This CL refactors the Angular Components ARIA accordion to simplify how triggers are associated with their content panels.
Previously, ngAccordionTrigger and ngAccordionPanel were matched using a shared panelId string input. This required the ngAccordionGroup to query for all triggers and panels and link them up after they were rendered.
This change replaces the panelId system with a more direct approach:
The ngAccordionPanel is now given a template reference variable (e.g., #myPanel).
The corresponding ngAccordionTrigger now takes the template reference variable as an input (e.g., [panel]="myPanel").
This allows Angular to directly link the trigger and panel instances, removing the need for the group to match them based on IDs and eliminating the AccordionPanelPattern class. The logic for finding the active trigger based on an element has been moved into the AccordionGroupPattern.