Dynamic checkboxes and number count

I am playing around with a drop down filter with filter options. When i click and make a checkbox active, a number count appears and and adds +1 to the count. Same when i uncheck the checkbox, the count goes down -1

The only issue i have is when i open and close the drop down. When i first open the drop down and check/uncheck my checkbox, the number + background of the numbers turns visible and adds or subtracts 1. If i click on the drop down button or outside the drop down menu, it closes. But, and here is the issue, when i re-open the drop down menu, the number gets +1 added to it and i have no clue why.

This i show i have set it up:

The interaction from hover state to checked has the variable ShowGreenBG true.

Im not sure, but it feels like i re-activate a “onClick” somehow. I would love to get some help with this. Im not a programmer but im fairly good at understanding code and logic but this stomps me.

1 Like