I have written and tweeted about this particular issue before, but I’ve just encountered it in a trad-pub book so I’m saying it again. (No, I won’t say which publisher or which title. That doesn’t matter one bit.)
Character A says a thing.
In the next paragraph, Character B reacts to it with an action. Character A reacts. Character B takes another action. There there’s a line of dialogue at the end of the paragraph.
Who said it?
Imagine it’s this bit of text.
“Stop it!” Dave said from inside the room.
Harry banged on the door hard enough for Dave to recoil in fear of it shattering inward. More banging and kicking, and one foot broke through at the bottom of the frame. “Why are you like this?”
Who spoke just then? Was it Dave, in reaction to Harry’s violence? Or was it Harry, in reaction to Dave’s locking himself in the room?
It’s not clear. We can take a guess, but what if we’re wrong? We shouldn’t have to read the next line to find out if we were right. If the next line is something like “I’m like this because you locked yourself in,” we know it was Dave who asked the question at the end of that paragraph. If it’s something like “Because you’re scaring the shit out of me,” we know it was Harry.
We shouldn’t have to guess. The uncertainty has intruded on our reading enjoyment, broken our flow. Clarity isn’t difficult. Actions might speak louder than words, and sometimes that’s a problem.
How to address the issue, then? A little fiddling goes a long way. In the paragraph with the banging and reacting and kicking, we could recast like this:
Harry banged on the door hard enough for Dave to recoil from fear of it shattering inward. When he saw a foot break through at the bottom of the frame, he dove behind the chair. “Why are you like this?” His breath came in great ragged gasps.
Now, there’s no question about who’s speaking. It’s not always required that dialogue go on a new line; in cases like this, it makes sense for it to flow directly after the narrative and be followed by a bit of description that clearly identifies the speaker (much more useful than “he said”).