Shift locks when pressing certain keys on Macbook pro
I have a problem with my Macbook pro which has a M1 chip. Pressing some of my keys locks my shift. This isn't the cap lock. I used the virtual keyboard to check the input. Which keys locks it for some reason changes sometimes. A few keys unlocks my shift, they are: "-", "o", "l", ".". Something really weird is that sometimes a light tap to a key will not lock shift but a slightly longer tap will. The problem happened randomly and changed randomly without me doing any damage that I know of.
I have tried restarting and tried switching accounts, but the problem persists. The only solution was using a external keyboard or virtual keyboard which does not have any of the problems.
This problem makes it impossible to type unless I use the solution above which is very inconvenient. Does anyone have a diagnosis or solution?