I discovered that this is a system-wide problem (occurs in all applications). So it's not really an Emacs bug.