We used to pray with animals passing in front of us. We mentioned that to the Prophet ﷺ and he said: “If you put something the height of the back of a saddle in front of you, then it will not matter what passes beyond it.”
كُنَّا نُصَلِّي وَالدَّوَابُّ تَمُرُّ بَيْنَ أَيْدِينَا فَذَكَرْنَا ذَلِكَ لِلنَّبِيِّ ﷺ فَقَالَ مِثْلُ مُؤْخِرَةِ الرَّحْلِ تَكُونُ بَيْنَ يَدَيِ أحَدِكُمْ ثُمَّ لَا يَضُرُّهُ مَا مَرَّ عَلَيْهِ وَقَالَ عُمَرُ مَرَّةً بَيْنَ يَدَيْهِ