@@ -132,28 +132,39 @@ export class SearchManager {
132132 }
133133 // In SearchManager class, update _showAutocomplete method
134134 _showAutocomplete ( results ) {
135- // ✅ DYNAMIC CONTAINER QUERY (avoids timing issues)
135+ // DYNAMIC CONTAINER QUERY (avoids timing issues)
136136 const container = document . getElementById ( 'search-autocomplete' ) ;
137+
137138 if ( ! container ) {
138- console . error ( '[SearchManager] ❌ FATAL: #search-autocomplete NOT FOUND in DOM!' ) ;
139- console . error ( '[SearchManager] Possible causes:' ) ;
140- console . error ( ' 1. HTML missing id="search-autocomplete"' ) ;
141- console . error ( ' 2. Script executing before DOM ready (Vercel optimization)' ) ;
142- console . error ( ' 3. Build process altered HTML structure' ) ;
139+ console . error ( '[SearchManager] ❌ FATAL: #search-autocomplete MISSING from DOM!' ) ;
140+ console . error ( '[SearchManager] This means your BUILD PROCESS stripped the HTML container.' ) ;
141+ console . error ( '[SearchManager] SOLUTION: Check scripts/fix-html-paths.js preserves the container' ) ;
143142
144- // ✅ EMERGENCY FALLBACK : Create container dynamically
143+ // EMERGENCY: Create container dynamically as last resort
145144 const searchInput = document . getElementById ( 'location-search' ) ;
146145 if ( searchInput ?. parentElement ) {
147- console . warn ( '[SearchManager] 🚑 Creating missing #search-autocomplete container...' ) ;
148- const newContainer = document . createElement ( 'div' ) ;
149- newContainer . id = 'search-autocomplete' ;
150- newContainer . className = 'search-autocomplete' ;
151- newContainer . setAttribute ( 'role' , 'region' ) ;
152- newContainer . setAttribute ( 'aria-live' , 'polite' ) ;
153- searchInput . parentElement . appendChild ( newContainer ) ;
146+ console . warn ( '[SearchManager] 🚑 Creating emergency container...' ) ;
147+ const emergencyContainer = document . createElement ( 'div' ) ;
148+ emergencyContainer . id = 'search-autocomplete' ;
149+ emergencyContainer . className = 'search-autocomplete' ;
150+ emergencyContainer . style . cssText = `
151+ position: absolute;
152+ top: 100%;
153+ left: 0;
154+ right: 0;
155+ background: white;
156+ border: 1px solid #ddd;
157+ border-radius: 8px;
158+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
159+ z-index: 1000;
160+ display: block;
161+ max-height: 300px;
162+ overflow-y: auto;
163+ margin-top: 8px;
164+ ` ;
165+ searchInput . parentElement . appendChild ( emergencyContainer ) ;
154166 // Retry with new container
155167 this . _showAutocomplete ( results ) ;
156- return ;
157168 }
158169 return ;
159170 }
0 commit comments