diff --git a/frontend/src/components/SingleQuestion.vue b/frontend/src/components/SingleQuestion.vue index 5d587a39..daaf1e43 100644 --- a/frontend/src/components/SingleQuestion.vue +++ b/frontend/src/components/SingleQuestion.vue @@ -12,9 +12,22 @@ }>(); const expanded = ref(false); + const answersContainer = ref(null); // Ref for the answers container function toggle(): void { expanded.value = !expanded.value; + + // Scroll to the answers container if expanded + if (expanded.value && answersContainer.value) { + setTimeout(function () { + if (answersContainer.value) { + answersContainer.value.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + } + }, 100); + } } function formatDate(timestamp: string | Date): string { @@ -109,7 +122,8 @@