diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index f3880736e..78688de88 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -879,14 +879,21 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr public changeStep(index: number, dataset?: FormControl) { this.step = index; + this.resetScroll(); } public nextStep() { this.step = this.step < this.maxStep ? this.step + 1 : this.step; + this.resetScroll(); } public previousStep() { this.step = this.step !== 0 ? this.step - 1 : this.step; + this.resetScroll(); + } + + private resetScroll() { + document.getElementById('dataset-editor-form').scrollTop = 0; } isDirty() { diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index a3ac243a6..f2aee90be 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -823,11 +823,13 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC public changeStep(index: number, dataset?: FormControl) { this.step = index; + this.resetScroll(); if (dataset) { this.datasetId = dataset.get('id').value }; } public nextStep() { this.step = this.step < this.maxStep ? this.step + 1 : this.step; + this.resetScroll(); if (this.step >= this.stepsBeforeDatasets) { this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value; } @@ -835,11 +837,16 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC public previousStep() { this.step = this.step !== 0 ? this.step - 1 : this.step; + this.resetScroll(); if (this.step >= this.stepsBeforeDatasets) { this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value; } } + private resetScroll() { + document.getElementById('editor-form').scrollTop = 0; + } + public isDirty(): boolean { return this.formGroup.dirty && this.hasChanges; // do we need this.formGroup.dirty }