The idea is to hookup custom deselect event on the Radio button that fires (for all) when any other radio gets selected / changed.
Problem :
So I’ve created a radio component, and i have an onChange function run, but it doesn’t trigger when the radio is deselected by another radio with the same group name, why?
Yes, thats exactly how its supposed to work. Change is triggerd for the element that is clicked. If your use case needs you to list all other radios tat have been deselected, I would recommend trying to set a value to each radio and then in your change handler, try and incorparate the logic for selecting all deselected radios with something like this:
Comment posted by Agochar Bhatia
@MujeebQureshi could you elaborate further on how I would use e.target.value?
Comment posted by Mujeeb Qureshi
I see there has already been an answer added that should suffice. If you still want a approach that fires an event on deselect let me know.
Comment posted by Agochar Bhatia
@MujeebQureshi, if possible could you still show me, as the answer might me more implementable into my project. thanks
Comment posted by Agochar Bhatia
Would there be any way to add custom things such as labels or other elements in between each radio?
Comment posted by Chakib Salah
@AgocharBhatia Yes , I just edited my answer and you can find there how to do so , or you can check again the sandbox code .
Comment posted by Agochar Bhatia
Thank you so much for spending the time to answer this question! I truly appreciate it.