This problem manifests in the following ways: whenever a person enters or leaves the raid or battleground; or when anything else happens that would cause the frames to rearrange; some or all of the frames stop functioning correctly. The names on frames no longer properly correspond to the players these frames target. A single player's name may appear on multiple frames, but only one of those frames actually targets the right person.
The reason this problem occurs is because of an unfortunate and subtle interaction between Blizzard raid frames and third-party add-ons. The default raid frames expect to execute with privileges that WoW reserves only for trusted, Blizzard-provided UI code. When the frames work correctly, the buttons that correspond to individual players will adjust when a person enters or exits the raid while you're in combat. This in-combat adjustment of frames is a feature that's available only to trusted, Blizzard-provided code, but is not available to third-party add-ons.
Before the ability to move frames while in combat was removed from third-party add-ons, there were healing add-ons which sorted raid frames automatically by health percentage. This made it possible to heal with relative effectiveness by just repeatedly clicking the same button, which made manual healing boring, and made it easy to fully automate healing.
So how do the raid frames stop working?
Since secure code and insecure code in WoW can interact, Blizzard implements a "tainting" mechanism, which tracks how the insecure code is executed, and may cause a previously secure component to be labeled "insecure" if it is influenced, even in a very subtle manner, by code that is insecure. This, in a nutshell, is how the raid frames stop working. Another add-on - quite frequently an add-on that's completely unrelated to raid frames - causes the raid frames to become "tainted". This, in turn, causes WoW to start treating raid frames as insecure code, which means that the raid frames can no longer adjust while in combat. When the code that implements the raid frames tries to adjust to a person entering or leaving, the internal WoW security mechanisms prevent that from working properly, and the raid frames end up being corrupted.
If you're like me, you run WoW with something like 15 different add-ons. You're willing to give up some of them, but not others. So how do you determine which add-on is causing the problem?
Fortunately, there's an easy way. Create a macro with the following contents:
Give it a name like "Taint", and bind it to a key so you can execute it easily, at any time.
When you execute this macro, it will print to your chat log either the following:
indicating that the raid frames are secure and untainted; or, it will output the following:
indicating that the raid frames are tainted, and the listed add-on was involved.
Not all the add-ons involved in the tainting will be shown at once. However, the name of one add-on is enough to disable it, and then you can repeat the process until your raid frames are no longer being corrupted.
In my case, using WoW patch 18.104.22.16895, the offending add-on was Altoholic, and its component, DataStore. In your case, the offending add-on might be something different.