The sukka must be built under the open sky so that the sekhakh and nothing else covers those sitting inside. Thus, if one builds a sukka under a roof or a tree, it is invalid (Sukka 9b). However, a sukka may be built next to a tall building that prevents sunlight from reaching the sukka. Only a roof or branches that separate between the sekhakh and the sky invalidate the sukka. Anything off to the side, not directly over the sekhakh, does not invalidate the sukka.
If there are very thin tree branches above the sekhakh, while the sekhakh is thick enough that even if the sekhakh directly under the branches would be removed, the remaining sekhakh would provide more shade than sun in the sukka, the sukka is kosher (SA OḤ 626:1).[12]
One may build a sukka underneath clotheslines or electric wires. Since they are very thin, provide very little shade, and are not meant to provide shade, they do not invalidate the sekhakh beneath them.
If a sukka is adjacent to a tree whose branches sway over the sukka when wind blows, it is kosher, even if the shade provided by the branches above the sukka when the wind blows exceeds the sunlight they let through, since the branches are not permanently above the sukka (Maharsham, Da’at Torah 626:3). R. Zvi Pesaḥ Frank (Mikra’ei Kodesh 1:23) is uncertain about this. Therefore, le-khatḥila it is preferable to cut off these branches; see the Harḥavot. In contrast, while a helicopter or hot air balloon is hovering over a sukka, it is invalidated, because they do not sway randomly with the wind but are intentionally guided there by people (Da’at Torah, op. cit.). Once they fly away, the sukka is once again kosher, in line with what Rema writes (626:3).