(el: T)
| 85 | * Prepares the overlay element to be presented. |
| 86 | */ |
| 87 | export const prepareOverlay = <T extends HTMLIonOverlayElement>(el: T) => { |
| 88 | if (typeof document !== 'undefined') { |
| 89 | /** |
| 90 | * Adds a single instance of event listeners for application behaviors: |
| 91 | * |
| 92 | * - Escape Key behavior to dismiss an overlay |
| 93 | * - Trapping focus within an overlay |
| 94 | * - Back button behavior to dismiss an overlay |
| 95 | * |
| 96 | * This only occurs when the first overlay is created. |
| 97 | */ |
| 98 | connectListeners(document); |
| 99 | } |
| 100 | const overlayIndex = lastOverlayIndex++; |
| 101 | /** |
| 102 | * overlayIndex is used in the overlay components to set a zIndex. |
| 103 | * This ensures that the most recently presented overlay will be |
| 104 | * on top. |
| 105 | */ |
| 106 | el.overlayIndex = overlayIndex; |
| 107 | }; |
| 108 | |
| 109 | /** |
| 110 | * Assigns an incrementing id to an overlay element, that does not |
no test coverage detected