We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a5ca931 + b8d2710 commit 5bced15Copy full SHA for 5bced15
src/use/useFocusManager.ts
@@ -4,7 +4,7 @@ import {
4
inject,
5
ref,
6
computed,
7
- watchEffect,
+ watch,
8
onUnmounted,
9
} from 'vue';
10
@@ -33,13 +33,17 @@ export function useFocusManager({ trapping }: Options) {
33
34
const canSafelyFocus = computed(() => trapFocusList.value[0] === String(id));
35
36
- watchEffect(() => {
37
- if (!trapping) {
38
- return;
39
- }
40
-
41
- addFocusItem(String(id));
42
- });
+ watch(
+ () => [trapping, id],
+ ([newTrappingVal, newId]) => {
+ if (!newTrappingVal) {
+ return;
+ }
+
43
+ addFocusItem(String(newId));
44
+ },
45
+ { immediate: true }
46
+ );
47
48
onUnmounted(() => {
49
removeFocusItem(String(id));
0 commit comments