As others already said, when shooting at night you almost always need to focus manually. When doing astro photos, if you can find a bright star or planet, you can try to manually focus on them using your camera live view feature.
If you can't find any star or planet bright enough, you can focus on a light that's far enough to be, essentially, at a distance indistinguishable from infinity from any practical point of view. Such a distance is called hyperfocal distance.
Hyperfocal distance depends on the camera sensor, lens focal length and aperture, and you can find several calculators, tables or even mobile apps to know it.
For your Canon T3 camera with a Canon 10-18 mm lens, the hyperfocal distance is about 4 m (at 18 mm and at f/4.5). This means that if you focus on a flashlight slightly farther than 4 m, anything farther than that flashlight will still be in focus, even the stars.
See the following diagram from Hyperfocal Pro app for Android, that shows that anything at a distance bigger than your
hfdwill appear in focus (
hfd stands for hyperfocal distance and
DOFstands for depth of field - the interval of distance where everything appears in focus).
If your flashlight is bright enough, you can even use autofocus to focus on it.
So you can use the following workflow to quickly and effectively focus for the stars:
- Get the hyperfocal distance for your camera+lens system.
- Put a flashlight ad a distance farther than your calculated hyperfocal distance, and point it at your camera.
- Use autofocus to focus on the flashlight.
- Once the camera is successfully focused, check the focus with live view (use maximum zoom) and then disable autofocus (I suggest to tape the focus ring on your lens, to avoid any accidental change of focus).
- Point your camera at the sky, check again your focus using live view, and then compose your photo and take it.
Once you focus on infinity the first time, you often don't need change focus again as long as you're shooting anything farther than hyperfocal distance. But remember that after changing focal length (zooming) you need to focus again.