No it is not "good practice" but as you can see from the code section copied below it is code compliant.
110.26 Spaces About Electrical Equipment.
Sufficient access and working space shall be provided and maintained about all electric equipment to permit ready and safe operation and maintenance of such equipment. Enclosures housing electrical apparatus that are controlled by lock and key shall be considered accessible to qualified persons.
(E) Headroom. The minimum headroom of working spaces about service equipment, switchboards, panelboards, or motor control centers shall be 2.0 m (6½ ft). Where the electrical equipment exceeds 2.0 m (6½ ft) in height, the minimum headroom shall not be less than the height of the equipment.
Exception: In existing dwelling units, service equipment or panelboards that do not exceed 200 amperes shall be permitted in spaces where the headroom is less than 2.0 m (61/2 ft).