MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / present

Method present

core/src/components/alert/alert.tsx:433–453  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

431 */
432 @Method()
433 async present(): Promise<void> {
434 const unlock = await this.lockController.lock();
435
436 await this.delegateController.attachViewToDom();
437
438 await present(this, 'alertEnter', iosEnterAnimation, mdEnterAnimation).then(() => {
439 /**
440 * Check if alert has only one button and no inputs.
441 * If so, then focus on the button. Otherwise, focus the alert wrapper.
442 * This will map to the default native alert behavior.
443 */
444 if (this.buttons.length === 1 && this.inputs.length === 0) {
445 const queryBtn = this.wrapperEl?.querySelector('.alert-button') as HTMLButtonElement;
446 queryBtn.focus();
447 } else {
448 this.wrapperEl?.focus();
449 }
450 });
451
452 unlock();
453 }
454
455 /**
456 * Dismiss the alert overlay after it has been presented.

Callers 2

onIsOpenChangeMethod · 0.95
componentDidLoadMethod · 0.95

Calls 3

presentFunction · 0.90
lockMethod · 0.80
attachViewToDomMethod · 0.65

Tested by

no test coverage detected