22 lines
1.3 KiB
Markdown
22 lines
1.3 KiB
Markdown
# Contract: Dropdown Placement
|
|
|
|
Part of [controls-selection](../contract.md).
|
|
|
|
## Dropdowns and Popups
|
|
|
|
Applies to every floating panel anchored to a control: autocomplete/combobox lists, custom
|
|
selects, multiselect filters, menus, date pickers.
|
|
|
|
- A panel opens below its control by default. When it does not fit below and there is more room
|
|
above, it opens upward. Decide on every open and on scroll/resize while open, from the control's
|
|
actual position in the viewport; never hardcode a direction.
|
|
- A panel must never extend past the viewport edge. If it fits neither way, cap its height to the
|
|
room available on the chosen side and let it scroll.
|
|
- A panel must not be clipped by an ancestor's `overflow` (modal body, table wrapper). Position it
|
|
against the viewport (`position: fixed` or a body-level layer), not inside the clipping container.
|
|
- Implement placement once in the shared dropdown code; do not re-derive it per control.
|
|
- A narrow table input may open a wider, content-sized suggestion panel. Clamp both horizontal
|
|
position and width to the viewport, as well as vertical height. Keep option labels useful:
|
|
identity, relevant status, quantity and price can share one compact line. Decorative price
|
|
tiers must not replace the actual amount or imply a stock/risk status.
|