Skip to content

Commit

Permalink
fix(matchticker): dota2 main page - upcoming matches show in Completed (
Browse files Browse the repository at this point in the history
#4788)

dispatch click event when active class is add
  • Loading branch information
liquidely authored Sep 25, 2024
1 parent bc5b1da commit 9ce6a58
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions javascript/commons/SwitchButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* Properties:
* The switch button can be easily accessed and manipulated by other components using the getSwitchGroup method.
*
* SwithGroup object contains the following properties:
* SwitchGroup object contains the following properties:
* - type: The type of the switch group (toggle or pill).
* - name: The name of the switch group.
* - activeClassName: The class name that is added to the active switch button.
Expand Down Expand Up @@ -120,10 +120,13 @@ liquipedia.switchButtons = {
targetValue
) );
} else {
switchGroup.nodes.forEach( ( node ) => node.classList.toggle(
switchGroup.activeClassName,
targetValue === node.dataset.switchValue
) );
switchGroup.nodes.forEach( ( node ) => {
const isActive = targetValue === node.dataset.switchValue;
node.classList.toggle( switchGroup.activeClassName, isActive );
if ( isActive ) {
node.dispatchEvent( new Event( 'click' ) );
}
} );
}
},

Expand Down

0 comments on commit 9ce6a58

Please sign in to comment.