The top four slots of my character inventory become locked for anywhere between one to five minutes after sleeping in a bed overnight. I've not yet had a thunderstorm appear so I have not been able to test if the problem occurs with any bed usage, but so far it is every bed, underground or in the overworld, that causes this issue to occur.
Thank you for your report!
We're actually already tracking this issue in MC-143776, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.