Description
Problem:
Wrapping a Dropdown
in a Loading
causes visually jarring page re-layouts:
-
Wrap a
Dropdown
in aLoading
- that is, the list of options is fetched from some slow data source, where this data source is specified by some user input. -
When the use specifies a new data source, the
Dropdown
element is temporarily replaced by a CSS spinner. This spinner is taller than theDropdown
, so everything below theDropdown
is moved a few pixels downward. This is visually jarring. -
When the list of options arrives, the spinner is replaced back by the original
Dropdown
, which is less tall than the spinner, so everything below theDropdown
is moved a few pixels up. This again is visually jarring.
Solution:
Reduce the height of the spinner to exactly match the height of the input elements (dropdown, button, text, etc.). All these elements have the same height, which is quite sufficient for displaying the spinner (the extra height seems to be just padding - this may depend on the spinner type though).
Alternatives:
It might be possible to override the height of the spinner using CSS but it isn't clear which class name to use, and whether this name is guaranteed to work in future versions.
Edit: Perhaps just document the CSS structure of the spinners so controlling their size would be guaranteed to be stable?