Because the JWST is not at the L2, but in a halo orbit around it, Earth in fact never covers the Sun at all from its point of view. They are just always fairly close to each other.
Interesting!
It’s so the sun and the earth will always be in the same direction and both can be hidden behind the sun shield.