I had to stop using the Keychron keyboard. It was becoming unreliable: key presses were not being registered, or duplicates events were being emitted. I’ll go back to my Microsoft Sculpt as soon as I get batteries for it.

Follow up

Okay, it looks like restoring factory settings helped. The keys seem to be functional again, at least after a few hours. I can’t for the life of me understand why this would be necessary. But hey, looks like it is.