You are praying in the masjid, and right in the middle of the salah, an old man or a kid comes up from behind you and places a plastic cap over your head.
Almost every guy has faced this, those who don’t wear caps to prayer.
Why is it that some people are so rigid regarding this while others are not.
This again stems from a difference in opinion, the people who support the notion of wearing cap, they take it from the example of how Prophet Muhammad (saw) lived his life wherein, he almost always had his head covered with a turban or a skull cap (kufi).
Hence the conclusion that it is a sunnah to wear the cap, and many other reputed scholars have classified wearing cap especially in Salah as mustahabb ( which means highly encouraged).
But you see, some people take it a bit further, in Hanafi school of thought for example, they site a quote of Sheikh Albani which was that it is Makrooh (disliked) to not cover the head while praying.
And this too only a small part of Hanafis take as makrooh, quite a majority especially the misinformed consider it a FARZ to wear caps in Salah and that is why people will come from behind and place a cap on you if you aren’t wearing one, which is not something that is advisable though it is clear that the intention is good.
But taking the consensus of the majority, it has been concluded that wearing the cap is a Sunnah, and only that, it is not even a wajib sunnah i,e something that the Prophet did and told his followers to do as well.
The Prophet (saw) never ordered his followers to cover their heads or to wear a cap.
To sum up, if you wear a cap, good. If you don’t there is no problem with that at all.
And Allah knows best.