Talha bin Ubaydullah reported,

We used to pray while animals passed in front of us. This was mentioned to the Messenger of Allah ﷺ, and he said, "If something like the back of a saddle is placed in front of one of you, then whoever passes beyond it will not harm his prayer."

Ibn Majah 940

Sahih

حدثنا محمد بن عبد الله بن نمير حدثنا عمر بن عبيد عن سماك بن حرب

عن موسى بن طلحة عن أبيه قال

كنا نصلي والدواب تمر بين أيدينا فذكر ذلك لرسول الله ﷺ فقال مثل مؤخرة الرحل تكون بين يدي أحدكم فلا يضره من مر بين يديه

ابن ماجه 940صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
What covers the one who prays
Numbering
Darussalam 940
Ibn Majah 940