Dizziness sometimes crops up in people with perfectly normal balance systems. Motion sickness is an example of this, but there are other forms, too. Your inner ears constantly detect whether or not your head is moving, but your eyes also do this. As you turn your head, your eyes move to counter-balance the head movement, and then jump forward to focus on the world again. This is a form of normal, physiologic nystagmus. Your arms and legs also detect movement and feed back to your brain to help you maintain balance by controlling sway. A problem occurs if the head motion detected by the inner ears does not match what is coming in from vision or the body. Height vertigo is a very common manifestation of this problem.
As your head normally sways a bit forward and back, objects nearby in front of you become slightly larger, then slightly smaller in the field of vision. Vision picks up these changes and generates a feeling of movement that exactly matches the movement felt in your head by your ears. However, if there are no objects within several feet on which to focus, your eyes cannot detect this visual motion. For example, when you look at the full moon, swaying back and forth does not cause any change in its size because it is too far away for this effect to occur.
Normally when there are no nearby objects, the ground is still only a few feet from your eyes and can be used as a substitute focal point. However, if the ground drops away in front of you at the edge of a cliff, the top of a building or on a tall stairway, there is not enough ground available to be used as a visual sway reference. In this case, you feel head motion in your inner ears as you sway, but no motion is detected by your eyes. Without this feedback the tendency for you to sway increases, further worsening your stability. People who are visually dependent for balance because of an inner ear disease are more susceptible to this problem because they trust their eyes more for balance than their malfunctioning ears.
Height vertigo can be reduced by turning so that the drop-off is to the side rather than directly in front of you. Look for a solid, fixed object within a few feet to use as a visual reference, like a wall or tall shrubs. Touching a nearby support with the hand can improve input from your limbs to the balance system, reducing sway. Most people instinctively do this when going downstairs by holding the railing and looking at the wall or the steps rather than straight ahead. This helps reduce the feeling of imbalance.

This helped me understand why I lost my balance as I stepped off the stairs in the dimly lit cavern.