forked from CIT/Vmeda.Online
		
	MOBILE-3320 core: Revert some auto-focus changes
This commit is contained in:
		
							parent
							
								
									1c0f7ad42e
								
							
						
					
					
						commit
						e123c88214
					
				@ -30,7 +30,7 @@ import { CoreUtils } from '@services/utils/utils';
 | 
			
		||||
})
 | 
			
		||||
export class CoreAutoFocusDirective implements AfterViewInit {
 | 
			
		||||
 | 
			
		||||
    @Input('core-auto-focus') showKeyboard: boolean | string = true;
 | 
			
		||||
    @Input('core-auto-focus') autoFocus: boolean | string = true;
 | 
			
		||||
 | 
			
		||||
    protected element: HTMLElement;
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ export class CoreAutoFocusDirective implements AfterViewInit {
 | 
			
		||||
     * @inheritdoc
 | 
			
		||||
     */
 | 
			
		||||
    ngAfterViewInit(): void {
 | 
			
		||||
        if (this.showKeyboard === 'nofocus') {
 | 
			
		||||
        if (CoreUtils.isFalseOrZero(this.autoFocus)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -78,8 +78,7 @@ export class CoreAutoFocusDirective implements AfterViewInit {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            const showKeyboard = this.showKeyboard === '' || CoreUtils.isTrueOrOne(this.showKeyboard);
 | 
			
		||||
            CoreDomUtils.focusElement(element, showKeyboard);
 | 
			
		||||
            CoreDomUtils.focusElement(element);
 | 
			
		||||
 | 
			
		||||
            if (element != document.activeElement) {
 | 
			
		||||
                this.setFocus(retries - 1);
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
                <ion-label class="sr-only">{{ 'core.login.username' | translate }}</ion-label>
 | 
			
		||||
                <ion-input type="text" name="username" placeholder="{{ 'core.login.username' | translate }}"
 | 
			
		||||
                    formControlName="username" autocapitalize="none" autocorrect="off" autocomplete="username" enterkeyhint="next"
 | 
			
		||||
                    required="true" core-auto-focus>
 | 
			
		||||
                    required="true">
 | 
			
		||||
                </ion-input>
 | 
			
		||||
            </ion-item>
 | 
			
		||||
            <ion-item *ngIf="siteChecked && !isBrowserSSO" class="ion-margin-bottom">
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
            <ion-item>
 | 
			
		||||
                <ion-label></ion-label>
 | 
			
		||||
                <ion-input type="text" name="value" placeholder="{{ 'core.login.usernameoremail' | translate }}"
 | 
			
		||||
                    formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]="showKeyboard">
 | 
			
		||||
                    formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]="autoFocus">
 | 
			
		||||
                </ion-input>
 | 
			
		||||
            </ion-item>
 | 
			
		||||
            <ion-button type="submit" class="ion-margin" expand="block" [disabled]="!myForm.valid">
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
    myForm!: FormGroup;
 | 
			
		||||
    siteUrl!: string;
 | 
			
		||||
    showKeyboard!: boolean;
 | 
			
		||||
    autoFocus!: boolean;
 | 
			
		||||
 | 
			
		||||
    constructor(
 | 
			
		||||
        protected formBuilder: FormBuilder,
 | 
			
		||||
@ -55,7 +55,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.siteUrl = siteUrl;
 | 
			
		||||
        this.showKeyboard = Platform.is('tablet');
 | 
			
		||||
        this.autoFocus = Platform.is('tablet');
 | 
			
		||||
        this.myForm = this.formBuilder.group({
 | 
			
		||||
            field: ['username', Validators.required],
 | 
			
		||||
            value: [CoreNavigator.getRouteParam<string>('username') || '', Validators.required],
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@
 | 
			
		||||
            <core-show-password name="password">
 | 
			
		||||
                <ion-input class="core-ioninput-password" name="password" type="password"
 | 
			
		||||
                    placeholder="{{ 'core.login.password' | translate }}" formControlName="password" [clearOnEdit]="false"
 | 
			
		||||
                    autocomplete="current-password" enterkeyhint="go" required="true" core-auto-focus>
 | 
			
		||||
                    autocomplete="current-password" enterkeyhint="go" required="true">
 | 
			
		||||
                </ion-input>
 | 
			
		||||
            </core-show-password>
 | 
			
		||||
        </ion-item>
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,7 @@
 | 
			
		||||
                    <h2>{{ 'core.login.siteaddress' | translate }}</h2>
 | 
			
		||||
                </ion-label>
 | 
			
		||||
                <ion-input name="url" type="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}"
 | 
			
		||||
                    formControlName="siteUrl" [core-auto-focus]="showKeyboard">
 | 
			
		||||
                    formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR">
 | 
			
		||||
                </ion-input>
 | 
			
		||||
            </ion-item>
 | 
			
		||||
        </ng-container>
 | 
			
		||||
@ -36,7 +36,7 @@
 | 
			
		||||
                    <h2>{{ 'core.login.siteaddress' | translate }}</h2>
 | 
			
		||||
                </ion-label>
 | 
			
		||||
                <ion-input name="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}" formControlName="siteUrl"
 | 
			
		||||
                    [core-auto-focus]="showKeyboard" (ionChange)="searchSite($event, siteForm.value.siteUrl)">
 | 
			
		||||
                    [core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)">
 | 
			
		||||
                </ion-input>
 | 
			
		||||
            </ion-item>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
        <ion-item>
 | 
			
		||||
            <ion-label></ion-label>
 | 
			
		||||
            <ion-input type="search" name="search" [(ngModel)]="searchText" [placeholder]="placeholder"
 | 
			
		||||
                [autocorrect]="autocorrect" [spellcheck]="spellcheck" [core-auto-focus]="autoFocus || 'nofocus'"
 | 
			
		||||
                [autocorrect]="autocorrect" [spellcheck]="spellcheck" [core-auto-focus]="autoFocus"
 | 
			
		||||
                [disabled]="disabled" role="searchbox" (ionFocus)="focus($event)">
 | 
			
		||||
            </ion-input>
 | 
			
		||||
            <ion-button slot="end" fill="clear" type="submit" size="small" [attr.aria-label]="searchLabel"
 | 
			
		||||
 | 
			
		||||
@ -391,12 +391,11 @@ export class CoreDomUtilsProvider {
 | 
			
		||||
     * Focus an element and open keyboard.
 | 
			
		||||
     *
 | 
			
		||||
     * @param el HTML element to focus.
 | 
			
		||||
     * @param showKeyboard Show keyboard when focusing the element.
 | 
			
		||||
     */
 | 
			
		||||
    focusElement(el: HTMLElement, showKeyboard = true): void {
 | 
			
		||||
    focusElement(el: HTMLElement): void {
 | 
			
		||||
        if (el?.focus) {
 | 
			
		||||
            el.focus();
 | 
			
		||||
            if (showKeyboard && CoreApp.isAndroid() && this.supportsInputKeyboard(el)) {
 | 
			
		||||
            if (CoreApp.isAndroid() && this.supportsInputKeyboard(el)) {
 | 
			
		||||
                // On some Android versions the keyboard doesn't open automatically.
 | 
			
		||||
                CoreApp.openKeyboard();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user