However, when I change my checkbox, I can see that this.checkboxTarget.checked != ev.target.checked. Indeed, this.checkboxTarget will be the first element of my checkboxes where ev will be the current element changed.
As I can understand, doing this.checkboxTarget is like doing document.querySelector(checkbox), which gives you the first node of the node list.
In my opinion, it’s a bit sad that this.checkboxTarget doesn’t mean here event as I did this:
Then, inside your toggleSubscription action, event.currentTarget will give you the checkbox that changed. (That works even if you click a <label> element linked to the input.)
Note a couple of other things in the snippet above:
I’ve used kebab-case for the controller identifier (users-page-account-newsletters), per Stimulus conventions.
Also note that you probably don’t need the data-target attribute unless you plan on doing something with all the checkboxes in aggregate. A good example of where they’d be useful is for implementing “subscribe to all” and “unsubscribe from all” actions: