Safari occasionally stops responding to mouse clicks

A rare but irritating problem I’ve had with Safari for a couple of years now is its habit of suddenly no longer responding to mouse clicks. It simply stops dead: you can’t click links, type in textareas, or even use the scrollbar.

Strangely, it will still respond to the keyboard, but as far as I know, there is no keyboard equivalent of mouse clicks, so this is not a solution.

The only thing that seems to cure it is to quit and restart Safari.