Sometimes it helps to see photos
(Fig. 1) rather than taxonomic names in a cladogram (Fig. 2). See for yourself the evolutionary changes that attend modern representatives of pre- or post-K/T boundary radiation of birds. Seems like when phylogenetic miniaturization happened (with Passer) then the arboreal realm, perching on small twigs, becomes possible. And long legs are primitive, at least until the giants appear.

Figure 1. Taxa in the chicken, sparrow, parrot clade, subset of the LRT.
Eudromius – long-leg terrestrial omnivore (paleognath clade)
Sagittarius – stilt-leg, hook-beak terrestrial predator (hawk/owl clade)
Ardeotis – stilt-leg, straight-beak terrestrial predator (heron/cuckoo clade)
Chauna – long-leg, terrestrial herbivore
Crex – short-leg, terrestrial herbivore
Gallus – short-leg, terrestrial herbivore
Passer – short-leg, miniaturized aerial/arboreal herbivore
Opisthocomus – short-leg, aerial/arboreal herbivore
Ara – short-leg, aerial/arboreal herbivore
Gastornis (Diatryma) and Dinornis – [extinct] giant. long-leg, terrestrial herbivore

Figure 2. Subset of the LRT focusing on birds. Here various aspects of birds are shown, including age, teeth, feeding behavior and basic clades.