From e67c1b2e062a89ef4c98ba5bfa8ef1b33213d45e Mon Sep 17 00:00:00 2001 From: ZDDC Date: Sun, 3 May 2026 22:21:51 -0500 Subject: [PATCH] fix(archive): point getElementById at the real root id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drag-drop.js and the unsupported-browser handler in app.js both referenced getElementById('app'), but the template's root has id="appContainer". The mismatch was masked in production because sourceMode='http' skips dragDrop.init() — only file:// (sourceMode= 'local') tripped over it, throwing "Cannot read properties of null (reading 'addEventListener')" at app load. Surfaced while header-standardizing the other tools; fixed by pointing both callers at #appContainer. --- archive/js/app.js | 2 +- archive/js/drag-drop.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/archive/js/app.js b/archive/js/app.js index ca1b01a..3537e32 100644 --- a/archive/js/app.js +++ b/archive/js/app.js @@ -300,7 +300,7 @@ // Show unsupported browser message function showUnsupportedBrowserMessage() { - const app = document.getElementById('app'); + const app = document.getElementById('appContainer'); app.innerHTML = `
diff --git a/archive/js/drag-drop.js b/archive/js/drag-drop.js index 9869a3f..bb7d880 100644 --- a/archive/js/drag-drop.js +++ b/archive/js/drag-drop.js @@ -24,8 +24,10 @@ // Handle drops on grouping folders (for creating transmittals) document.getElementById('groupingFoldersList').addEventListener('drop', handleDrop, false); - // Handle drops on the main app area (for adding directories) - document.getElementById('app').addEventListener('drop', handleAppDrop, false); + // Handle drops on the main app area (for adding directories). + // Note: the root element is id="appContainer" (id="app" was a + // stale reference that crashed dragDrop init in local mode). + document.getElementById('appContainer').addEventListener('drop', handleAppDrop, false); } // Prevent default behaviors