The national housing shortage, the benefits of increased density, an ongoing shift in consumer tastes toward smaller homes closer to where the urban action is, and other factors have pushed state legislators to make it easier to build accessory dwelling units.