MOBILE-3814 calendar: Select custom when item over input is clicked
parent
82c8186007
commit
a9d14f4fc3
|
@ -34,7 +34,7 @@
|
|||
</ion-label>
|
||||
<ion-radio slot="end" value="custom"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item class="ion-text-wrap">
|
||||
<ion-item class="ion-text-wrap" (click)="customInputClicked($event)">
|
||||
<ion-label></ion-label>
|
||||
|
||||
<div class="flex-row">
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
import { AddonCalendar, AddonCalendarReminderUnits, AddonCalendarValueAndUnit } from '@addons/calendar/services/calendar';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { ModalController } from '@singletons';
|
||||
|
||||
/**
|
||||
|
@ -166,11 +165,9 @@ export class AddonCalendarReminderTimeModalComponent implements OnInit {
|
|||
|
||||
this.radioValue = 'custom';
|
||||
|
||||
await CoreUtils.nextTick();
|
||||
|
||||
const target = <HTMLInputElement | Element | null> ev.target;
|
||||
if (target && 'focus' in target) {
|
||||
target.focus();
|
||||
const target = <HTMLInputElement | HTMLElement | null> ev.target;
|
||||
if (target) {
|
||||
CoreDomUtils.focusElement(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,19 +49,7 @@ export class CoreAutoFocusDirective implements AfterViewInit {
|
|||
|
||||
await CoreDom.waitToBeInDOM(this.element);
|
||||
|
||||
let focusElement = this.element;
|
||||
|
||||
if ('getInputElement' in focusElement) {
|
||||
// If it's an Ionic element get the right input to use.
|
||||
focusElement.componentOnReady && await focusElement.componentOnReady();
|
||||
focusElement = await focusElement.getInputElement();
|
||||
}
|
||||
|
||||
if (!focusElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
CoreDomUtils.focusElement(focusElement);
|
||||
CoreDomUtils.focusElement(this.element);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -336,12 +336,22 @@ export class CoreDomUtilsProvider {
|
|||
/**
|
||||
* Focus an element and open keyboard.
|
||||
*
|
||||
* @param focusElement HTML element to focus.
|
||||
* @param element HTML element to focus.
|
||||
*/
|
||||
async focusElement(focusElement: HTMLElement): Promise<void> {
|
||||
async focusElement(
|
||||
element: HTMLIonInputElement | HTMLIonTextareaElement | HTMLIonSearchbarElement | HTMLElement,
|
||||
): Promise<void> {
|
||||
let retries = 10;
|
||||
|
||||
if (!focusElement.focus) {
|
||||
let focusElement = element;
|
||||
|
||||
if ('getInputElement' in focusElement) {
|
||||
// If it's an Ionic element get the right input to use.
|
||||
focusElement.componentOnReady && await focusElement.componentOnReady();
|
||||
focusElement = await focusElement.getInputElement();
|
||||
}
|
||||
|
||||
if (!focusElement || !focusElement.focus) {
|
||||
throw new CoreError('Element to focus cannot be focused');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue