I had the same problem.
By pressing shift or caplock the MagicKeyboard wouldn't work anymore.
It turns out that the problem comes from the fact that I use the keyboard on both ubuntu and windows (dual boot).
When I connect the keyboard on ubuntu, it no longer works on windows because the keyboard and ubuntu share a sync key that windows does not know.
When I associate the keyboard on windows, it still works on ubuntu (when it shouldn't) until I press caplocks.
In fact, I think the bug is that the keyboard works a bit under ubuntu while the key is not good, if it returned an error we would find the problem right away.
To solve the problem, I reassociated the keyboard with windows and then I copied the connection key and I copied it in the bluetooth configuration of ubuntu.
Since my two OS share the same connection key for the keyboard, I don't have any more problems between the two OS and Capslock works well.
I had the same problem.
By pressing shift or caplock the MagicKeyboard wouldn't work anymore.
It turns out that the problem comes from the fact that I use the keyboard on both ubuntu and windows (dual boot).
When I connect the keyboard on ubuntu, it no longer works on windows because the keyboard and ubuntu share a sync key that windows does not know.
When I associate the keyboard on windows, it still works on ubuntu (when it shouldn't) until I press caplocks.
In fact, I think the bug is that the keyboard works a bit under ubuntu while the key is not good, if it returned an error we would find the problem right away.
To solve the problem, I reassociated the keyboard with windows and then I copied the connection key and I copied it in the bluetooth configuration of ubuntu.
Since my two OS share the same connection key for the keyboard, I don't have any more problems between the two OS and Capslock works well.
I followed this tutorial : https:/ /desktopi18n. wordpress. com/2018/ 02/02/bluetooth -mouse- in-dual- boot-of- windows- 10-and- linux/
Translated with www.DeepL. com/Translator (free version)