Generally speaking you want to look for a KVM with TTU (True Transparent USB) which is a patented USB emulation implemented on a custom ASIC. TTU is designed to support the extended features of multimedia keyboards etc.
There are TTU KVMs supporting up to 4K2K @ 60Hz over Displayport made by Uniclass, InLine and Lindy.
If you need to use HDMI it's a bit more difficult as there are (as yet) no HDMI KVMs advertising TTU capability. However I have just hooked up a brand new "AV Access" 4KSW41-KVM and although the manufacturer makes no mention of TTU, my K70 Lux was working fine straight away - even the volume wheel works as normal. It has high res audio and 7.1 surround audio passthrough, a steel chassis and it's comparatively cheap (GBP70 or USD80 on Amazon as of 2019-10-01).
http://www.avaccess.com/c627.html