As a test launch Photos with the Option key held down and create a new, test library. Import some photos and test to see if the same problem persists. Does it? This tells us if the problem is limited to your current library or is more wide spread.
Then close the test library and reopen your primary library and test again.
If that doesn't help boot into Safe Mode according to How to use safe mode on your Mac and test to see if the problem persists. Reboot normally and test again.
Note: if you have a wireless keyboard with rechargeable batteries connect it with its charging cable before booting into Safe Mode. This makes it act as a wired keyboard as will assure a successful boot into Safe Mode.
Have you installed and run any "cleaning", "optimizing", "speed-up", anti-virus or VPN apps on your Mac?
