Skip to main content

trackScroll

Description

Optional. Defines whether the dropdown closes when its container is scrolled

Usage

trackScroll?: boolean;

Values

  • true - the dropdown closes when the container (document body or popupContainer) is scrolled
  • false - (default) the dropdown remains open regardless of container scroll

Details

Applies only when inline is false. When enabled, prevents the dropdown from staying open after the input has scrolled out of view.

Example

<script>
import { Dropdown, Calendar } from "@svar-ui/svelte-core";

let popup;
</script>

{#if popup}
<Dropdown trackScroll={true}>
<Calendar value={new Date(2023, 2, 15)} />
</Dropdown>
{/if}

Related article: Closing Dropdown on scroll