Check filename header clicks in the right context.

This fixes #5740.