/** * Stacked Modals Handler * * P1 - Detection and management of stacked/nested modals * * Supports: * - Detection of stacked modals (multiple overlays) * - Z-index analysis * - Modal type detection (dialog, popover, dropdown) * - Modal hierarchy traversal * - Modal dismissal strategies * * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialogmodal/ */ export interface ModalInfo { /** Modal element selector */ selector: string; /** Modal type */ type: 'dialog' | 'popover' | 'dropdown' | 'tooltip' | 'alert' | 'custom'; /** Z-index */ zIndex: number; /** Position in stack (0 = bottom) */ stackPosition: number; /** Whether it's visible */ visible: boolean; /** Whether it blocks interaction with elements below */ blocksInteraction: boolean; /** ARIA attributes */ aria: { modal: boolean; labelledby?: string; describedby?: string; label?: string; }; /** Parent selector (if nested) */ parent?: string; /** Children selectors */ children: string[]; /** Close buttons/selectors */ closeSelectors: string[]; } export interface ModalHierarchy { /** Total number of modals detected */ totalModals: number; /** Number of visible modals */ visibleModals: number; /** Modal stack (bottom to top) */ stack: ModalInfo[]; /** Top-most modal */ topModal?: ModalInfo; /** Issues detected */ issues: string[]; } export interface ModalActionOptions { /** Wait for modal before action */ waitFor?: boolean; /** Timeout for waiting */ timeout?: number; } /** * Stacked Modals Handler class */ export declare class StackedModalsHandler { /** * Detect all modals on the page */ detectModals(page: any): Promise; /** * Get the top-most (active) modal */ getTopModal(page: any): Promise; /** * Wait for a modal to appear */ waitForModal(page: any, options?: { /** Type of modal to wait for */ type?: ModalInfo['type']; /** Selector to match */ selector?: string; /** Minimum z-index */ minZIndex?: number; /** Timeout in ms */ timeout?: number; }): Promise; /** * Close a modal */ closeModal(page: any, modal: ModalInfo | string, options?: ModalActionOptions): Promise; /** * Close all modals from top to bottom */ closeAllModals(page: any, options?: ModalActionOptions): Promise; /** * Get modal hierarchy for debugging */ getModalTree(page: any): Promise; /** * Verify modal accessibility */ verifyAccessibility(page: any, modal: ModalInfo | string): Promise<{ valid: boolean; issues: string[]; }>; /** * Get modal statistics */ getStatistics(page: any): Promise<{ byType: Record; averageZIndex: number; maxStackDepth: number; accessibilityScore: number; }>; } /** * Factory function to create Stacked Modals Handler */ export declare function createStackedModalsHandler(): StackedModalsHandler; export default StackedModalsHandler;