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 setup>
import { ref } from "vue";
import { Dropdown, Calendar } from "@svar-ui/vue-core";

const popup = ref(false);
</script>

<template>
<Dropdown v-if="popup" :trackScroll="true">
<Calendar :value="new Date(2023, 2, 15)" />
</Dropdown>
</template>

Related article: Closing Dropdown on scroll