* Logging into 'Ubuntu' instead of 'Ubuntu on Wayland'. That will mean key events are first handled by the 'Xorg' process and won't get delayed or lost by high CPU in the 'gnome-shell' process.
* Moving away from wifi devices that might be using 2.4GHz frequencies, as they will interfere with Bluetooth and cause packet loss, and some resends. I don't know how unique the resends of lost packets are for Bluetooth keyboards...
Please try:
* Logging into 'Ubuntu' instead of 'Ubuntu on Wayland'. That will mean key events are first handled by the 'Xorg' process and won't get delayed or lost by high CPU in the 'gnome-shell' process.
* Moving away from wifi devices that might be using 2.4GHz frequencies, as they will interfere with Bluetooth and cause packet loss, and some resends. I don't know how unique the resends of lost packets are for Bluetooth keyboards...