Changing back and forth between plain text editor and visual editor breaks citations. I have not managed to find a systematic reason for it. One definite reason is adding page numbers in text: [@elder1998, p. 4]. will turn into \[@elder1998, p. 4\] after changing to the visual editor. But also other references are damaged, not only those with a page number.
Is this still happening with last version of RStudio ?
Also, if you could try the daily version : https://dailies.rstudio.com/
Yes, I am on maOS RStudio version 2021.09.0+351 "Ghost Orchid" and R 4.1.1. If I have time I might test it with a daily
I also still have this issue on my Mac (Big Sur Version 11.6) but not on Windows 10. I have the newest RStudio version (in both cases) and I also tried the most recent daily version. For in-text citations it works, so I guess it has something to do with how brackets are handled.
I think it could be worth to open an issue in the IDE repo with a reproducible example. Maybe there is an issue with brackets handling as you said
Happens with daily version as well