diff --git a/client/src/app/modal/confirm.component.html b/client/src/app/modal/confirm.component.html index 09028dc1b..5d3c2dad0 100644 --- a/client/src/app/modal/confirm.component.html +++ b/client/src/app/modal/confirm.component.html @@ -14,9 +14,16 @@
- + - +
{{ errorMessage }}
diff --git a/client/src/app/shared/shared-forms/input-text.component.ts b/client/src/app/shared/shared-forms/input-text.component.ts index 2f3c8f603..dcfceb40e 100644 --- a/client/src/app/shared/shared-forms/input-text.component.ts +++ b/client/src/app/shared/shared-forms/input-text.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, forwardRef, Input, ViewChild } from '@angular/core' +import { AfterViewInit, Component, ElementRef, forwardRef, Input, ViewChild } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { FormReactiveErrors } from './form-reactive.service' @@ -14,7 +14,7 @@ import { FormReactiveErrors } from './form-reactive.service' } ] }) -export class InputTextComponent implements ControlValueAccessor { +export class InputTextComponent implements ControlValueAccessor, AfterViewInit { @ViewChild('input') inputElement: ElementRef @Input() inputId = Math.random().toString(11).slice(2, 8) // id cannot be left empty or undefined @@ -27,6 +27,7 @@ export class InputTextComponent implements ControlValueAccessor { @Input() readonly = false @Input() show = false @Input() formError: string | FormReactiveErrors | FormReactiveErrors[] + @Input() autofocus = false get inputType () { return this.show @@ -40,6 +41,12 @@ export class InputTextComponent implements ControlValueAccessor { : $localize`Show` } + ngAfterViewInit () { + if (this.autofocus !== true) return + + this.inputElement.nativeElement.focus({ preventScroll: true }) + } + toggle () { this.show = !this.show }