@sit-onyx/headless 1.0.0-beta.6 → 1.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/headless",
3
3
  "description": "Headless composables for Vue",
4
- "version": "1.0.0-beta.6",
4
+ "version": "1.0.0-beta.7",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
7
7
  "license": "Apache-2.0",
@@ -1,4 +1,4 @@
1
- import { computed, ref, unref, watchEffect, type MaybeRef, type Ref } from "vue";
1
+ import { computed, nextTick, ref, unref, watchEffect, type MaybeRef, type Ref } from "vue";
2
2
  import { createId } from "../..";
3
3
  import { createBuilder, type VBindAttributes } from "../../utils/builder";
4
4
  import { useTypeAhead } from "../helpers/useTypeAhead";
@@ -105,7 +105,7 @@ export const createListbox = createBuilder(
105
105
  const isFocused = ref(false);
106
106
 
107
107
  // scroll currently active option into view if needed
108
- watchEffect(() => {
108
+ watchEffect(async () => {
109
109
  if (
110
110
  !isExpanded.value ||
111
111
  options.activeOption.value == undefined ||
@@ -113,7 +113,10 @@ export const createListbox = createBuilder(
113
113
  )
114
114
  return;
115
115
  const id = getOptionId(options.activeOption.value);
116
- document.getElementById(id)?.scrollIntoView({ block: "nearest", inline: "nearest" });
116
+
117
+ await nextTick(() => {
118
+ document.getElementById(id)?.scrollIntoView({ block: "end", inline: "nearest" });
119
+ });
117
120
  });
118
121
 
119
122
  const typeAhead = useTypeAhead((inputString) => options.onTypeAhead?.(inputString));