Answered by Shaykh Faraz Rabbani
Question: I’ve learned in the Shafi’i madhab one’s prayer is invalid if one is praying while supporting filth. I was wondering is that the same in the Hanafi Madhab? For example, if one is praying and a baby with a dirty diaper jumps on you, is that prayer invalid?
Answer: Walaikum assalam wa rahmatullahi wa barakatuh,
I pray this finds you in the best of health and spirits.
If a baby with dirty diapers jumps on you, you should put them down without excessive delay. If you do so, your prayer remains valid.
It is permitted to carry babies if they’re clean, as is established from the Prophet (Allah bless him and give him peace) with his noble grandchildren (Allah be pleased with them).
And Allah alone gives success.
(Originally answered on the SeekersGuidance Academy’s Absolute Essentials of Islam Course Forum)