The photons are not detected at the slits. They are detected at a distance from the slits as illustrated here:
Photons or particles of matter (like an electron) produce a wave pattern when two slits are used
This has been done with single photons, as seen in this video.(after 2' it shows single photon interference), and this publication.. The detector of single photons in the video is a photomultiplier at the screen position.
Generally if a detector is put in one slit, the interference disappears. Here is the build up of single electron interference
Successively longer integration times as electron arrivals (white dots) are recorded.
There have been experiments exploring why when the slit the electron went through is known the interference pattern is destroyed. A recent one used the following method for detecting which slit the electron passed through:
they modified one of the slits by covering it with a filter made of several layers of “low atomic number” material to create a which-way detector for the electrons passing through.
They concluded that the method of detection changes the conditions to the point of destroying interference effects:
Overall, the results suggest that the type of scattering an electron undergoes determines the mark it leaves on the back wall, and that a detector at one of the slits can change the type of scattering. The physicists concluded that, while elastically scattered electrons can cause an interference pattern, the inelastically scattered electrons do not contribute to the interference process.