Browse Source

Fix ALL popups to display independently of hamburger menu

- Added ensurePopupInBody() helper function
- Applied fix to navigation confirm dialog
- Applied fix to resume navigation dialog
- Applied fix to remesh dialog
- Applied fix to route overlay
- Applied fix to geocache dialog
- All popups now moved to document.body before display

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
master
HikeMap User 1 month ago
parent
commit
9666837d47
  1. 19
      index.html

19
index.html

@ -2022,6 +2022,7 @@
}
// Show loading indicator and defer pathfinding to allow UI update
ensurePopupInBody('routeOverlay');
document.getElementById('routeOverlay').style.display = 'flex';
document.getElementById('navInfo').style.display = 'none';
@ -2727,6 +2728,16 @@
}, 100);
}
// Helper function to ensure popups are in body
function ensurePopupInBody(elementId) {
const element = document.getElementById(elementId);
if (element && element.parentElement !== document.body) {
console.log(`Moving ${elementId} to body from:`, element.parentElement.id || element.parentElement.className);
document.body.appendChild(element);
}
return element;
}
function showGeocacheDialog(geocache, isNew = false) {
// In nav mode, check if user is close enough to view/interact
let userDistance = Infinity;
@ -2736,7 +2747,8 @@
}
currentGeocache = geocache;
const dialog = document.getElementById('geocacheDialog');
// Ensure dialog is in body
const dialog = ensurePopupInBody('geocacheDialog');
const messagesDiv = document.getElementById('geocacheMessages');
const deleteBtn = document.getElementById('geocacheDelete');
const submitBtn = document.getElementById('geocacheSubmit');
@ -4966,6 +4978,7 @@
// Show confirmation dialog
const message = `Navigate to ${nearest.track.name}?`;
document.getElementById('navConfirmMessage').textContent = message;
ensurePopupInBody('navConfirmDialog');
document.getElementById('navConfirmDialog').style.display = 'flex';
isPressing = false;
}
@ -5047,6 +5060,7 @@
document.getElementById('pressHoldIndicator').style.display = 'none';
const message = `Navigate to ${pendingDestination.track.name}?`;
document.getElementById('navConfirmMessage').textContent = message;
ensurePopupInBody('navConfirmDialog');
document.getElementById('navConfirmDialog').style.display = 'flex';
lastTapTime = 0; // Reset to prevent triple tap
@ -5138,6 +5152,7 @@
pendingDestination = nearest;
const message = `Navigate to ${nearest.track.name}?`;
document.getElementById('navConfirmMessage').textContent = message;
ensurePopupInBody('navConfirmDialog');
document.getElementById('navConfirmDialog').style.display = 'flex';
}
} else if (currentTool === 'draw' && isDrawing) {
@ -6048,6 +6063,7 @@
document.getElementById('remeshDetails').innerHTML =
`<strong>Selected tracks:</strong> ${trackNames}<br>` +
`<strong>Current total points:</strong> ${totalPoints}`;
ensurePopupInBody('remeshDialog');
document.getElementById('remeshDialog').style.display = 'flex';
});
@ -6382,6 +6398,7 @@
if (savedDestination && savedNavMode === 'true') {
// Show resume navigation dialog
ensurePopupInBody('resumeNavDialog');
document.getElementById('resumeNavDialog').style.display = 'flex';
} else {
// Start in navigate mode by default if no saved state

Loading…
Cancel
Save