Keyboard freezes after pressing caps lock
For me resetting the NVRAM fixed it:

Shut down your Mac and start it again.
Hold Option, Command, P, and R keys.
Keep the keys pressed until:


You hear the startup sound playing for a second time – on non-T2 models
You see the Apple logo appear and disappear for the second time – on T2 models

From: https://windowsreport.com/mac/macbook-stuck-caps-lock/