fix(mobile): move modals to document.body to escape panel DOM constraints
Fix mobile modal positioning by moving modals to document.body on first use. Root cause: Modals were nested inside .rpg-panel which has 'transform' in its transition property (line 40 of style.css). This creates a containing block that constrains position:fixed children to the panel viewport instead of the document viewport, causing modals to be cut off on mobile. Changes: 1. confirmDialog.js - Modified showConfirmDialog() and showAlertDialog(): - Check if modal is already in document.body container - Create 'document-body-modals' container at body level (once) - Move modal to body container to escape panel constraints - Container has pointer-events: none to pass clicks through - Individual modals have pointer-events: auto to receive clicks 2. style.css - Added pointer-events: auto to .rpg-modal: - Ensures clicks work when modal is in pointer-events: none container Result: - Modals now render over entire SillyTavern viewport - Properly centered with full z-index stacking - No longer constrained by panel's transform/stacking context - Works correctly on both desktop and mobile
This commit is contained in:
@@ -1441,6 +1441,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 1rem; /* Ensure content doesn't touch screen edges on mobile */
|
||||
pointer-events: auto; /* Ensure clicks work when moved to body container */
|
||||
}
|
||||
|
||||
/* Modal Content Container */
|
||||
|
||||
Reference in New Issue
Block a user