fix(team participants): multiple card group toggles not working on same page#7044
Merged
fix(team participants): multiple card group toggles not working on same page#7044
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where multiple toggle buttons with the same data-switch-group on a page would fail to work correctly. Previously, only the first toggle in each group was registered and received click listeners.
Changes:
- Refactored switch group initialization to collect all DOM nodes sharing the same
data-switch-group - Added deduplication logic using
SetandWeakSetto prevent duplicate nodes and double-binding of event listeners - Ensured newly discovered nodes sync to the current switch value for consistent visual state
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
fwiw #6986 would also mitigate this to some degree :P |
hjpalpha
approved these changes
Feb 4, 2026
Collaborator
hjpalpha
left a comment
There was a problem hiding this comment.
seems reasonable on phone
Collaborator
Author
Sure, this will also prevent such cases in the future, not just this specific problem. And in some cases people might not want to wrap the cards in dynamic tabs Doesn't hurt to have both IMO |
Rathoz
approved these changes
Feb 4, 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.
Summary
Problem:
The Show All Toggle Buttons break if there's multiple present. (E.g in some cases the TeamParticpants will be split up due to there being groups / sections to split them off into.
See https://liquipedia.net/deadlock/User:Kanoodles/Testcase#Participants
SwitchButtons.js originally only registered the first toggle it found for a given data-switch-group. When the page had multiple CardsGroups using the same group names (team-cards-show-rosters, team-cards-compact), the later toggles were never added to the switch group and never got click listeners.
This PR makes switch groups collect and manage all DOM nodes that share the same data-switch-group:
How did you test this change?
dev tools
screenrecording-2026-02-04_13-38-19.mp4