()
| 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. |
no test coverage detected