When an anonymous user fills out a contribution or other form with a profile that includes the ability to select groups, the user may leave those checkboxes blank, like so:
If the anynomous user leaves a checkbox unchecked for a group and that anynomous user is deduped with an existing contact, who is currently a member of the same group, during the processing of the form, then the contact will be removed from the group.
If those groups are used as mailing lists, it is normal for users to leave the box unchecked (as they would not think that they need to check a checkbox to remain on a mailing list they have already signed up for). This is confusing for the user, who unintentionally removes themselves from a group. It is also confusing from the backend as it does not function the same as other fields (e.g. if the user leaves a phone number blank, their phone number is not erased).
This same behaviour is found with a custom field that uses checkboxes or multiselect, while it isn't the same in a custom field using select.
To me, this looks like it isn't the intended behaviour, as it is inconsistent with the behaviour of other fields. Perhaps it has to do with the order in which the deduplication happens relative to the groups. It is also inconsistent with how merging contacts normally works, where groups are added to, but not removed from, the merged contact.
Is this a bug? If it isn't a bug, is there a way to change the behaviour so users aren't removing themselves unintentionally from groups?
I think using a custom field and a smart group would likely solve this problem, but perhaps there is a better way—or this should be changed in general.