Skip to content

Commit

Permalink
fix bug when opening a different autocomplete than the currently open…
Browse files Browse the repository at this point in the history
…ed one
  • Loading branch information
NFriedo committed Dec 17, 2024
1 parent ade9a65 commit 6c0335c
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/modules/feature/room/RoomMembers/AddMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
variant="underlined"
:items="memberList"
:label="t('common.labels.name')"
:no-data-text="t('common.nodata')"
@update:menu="onAutocompleteToggle"
/>
</div>
Expand Down Expand Up @@ -90,6 +89,7 @@ import { PropType, ref, toRef } from "vue";
import { RoleName, SchoolForExternalInviteResponse } from "@/serverApi/v3";
import { RoomMember } from "@data-room";
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
import { VAutocomplete } from "vuetify/lib/components/index.mjs";
const props = defineProps({
memberList: {
Expand Down Expand Up @@ -129,16 +129,32 @@ const onAddMembers = () => {
emit("close");
};
const onAutocompleteToggle = (open: boolean) => {
if (open) {
const onClose = () => emit("close");
const addMembersContent = ref();
const { pause, unpause } = useFocusTrap(addMembersContent, {
immediate: true,
});
const autoCompleteSchool = ref<VAutocomplete>();
const autoCompleteRole = ref<VAutocomplete>();
const autoCompleteUsers = ref<VAutocomplete>();
const onAutocompleteToggle = () => {
const autocompleteRefs = [
autoCompleteSchool,
autoCompleteRole,
autoCompleteUsers,
];
const isAnyAutocompleteOpen = autocompleteRefs.some(
(autocomplete) => autocomplete.value?.menu
);
if (isAnyAutocompleteOpen) {
pause();
} else {
unpause();
}
};
const onClose = () => emit("close");
const addMembersContent = ref();
const { pause, unpause } = useFocusTrap(addMembersContent, { immediate: true });
</script>

0 comments on commit 6c0335c

Please sign in to comment.