Skip to content

Commit d401e85

Browse files
authored
Merge pull request #4181 from Jaspreet-singh-1032/fixes-4079-add-new-question-should-show-question-type
removed scroll on adding new question
2 parents 212b46b + 68dbb7f commit d401e85

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

contentcuration/contentcuration/frontend/channelEdit/components/AssessmentEditor/AssessmentEditor.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<transition-group name="list-complete" tag="div">
1313
<VCard
1414
v-for="(item, idx) in sortedItems"
15+
ref="questionCardRef"
1516
:key="`question-${item.assessment_id}`"
1617
pa-1
1718
class="elevation-4 list-complete-item"
@@ -333,6 +334,17 @@
333334
this.$analytics.trackAction('exercise_editor', 'Add', {
334335
eventLabel: 'Question',
335336
});
337+
this.$nextTick(() => {
338+
const questionCards = this.$refs['questionCardRef'];
339+
if (questionCards?.length >= 1) {
340+
const lastQuestionCard = questionCards[questionCards.length - 1].$el;
341+
const editorDiv = document.getElementById('editViewId');
342+
editorDiv.scrollTo({
343+
top: lastQuestionCard.offsetTop,
344+
behavior: 'smooth',
345+
});
346+
}
347+
});
336348
},
337349
async deleteItem(itemToDelete) {
338350
if (this.isItemActive(itemToDelete)) {

contentcuration/contentcuration/frontend/channelEdit/components/AssessmentItemEditor/AssessmentItemEditor.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,6 @@
285285
if (!this.question) {
286286
this.openQuestion();
287287
}
288-
// Assessments are nested inside of a scrolling panel.
289-
// Instead of propagating an event all the way back to
290-
// the scrolling panel, just use scrollIntoView
291-
// (supported by most major browsers)
292-
if (this.$el.scrollIntoView) {
293-
this.$el.scrollIntoView({ behaviour: 'smooth' });
294-
}
295288
},
296289
methods: {
297290
updateItem(payload) {

contentcuration/contentcuration/frontend/channelEdit/components/edit/EditView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22

3-
<VContainer ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
3+
<VContainer id="editViewId" ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
44
<VContainer v-if="!nodeIds.length" fluid>
55
<VLayout justify-center align-center fill-height>
66
<VFlex grow class="grey--text text-xs-center title">

0 commit comments

Comments
 (0)