Have you tried restarting Photoshop?
Is it happening with other layers/files?
You could try resetting the Photoshop Preferences. They can be found in the Photoshop menu on a Mac and the Edit menu on Windows. Within the General tab is the button Reset Preferences On Quit.
Yes, happens to all layers
I tried to do this but it didn't work 😕
That is a bit odd. Can you try right-clicking or using the Layers panel menu to see if either works?
yes, all this is working, the problem is only trying to rename the layers
I noticed that this problem only happens when there is some content on the layer, as I can easily rename the layer without any content
It may help if we could see your Photoshop System Info. Launch Photoshop, and select Help >System Info...and copy/paste the text in a reply.