fix: Refactor event handling in LocationSearch and streamline modal navigation logic in Modals

This commit is contained in:
alexsparkes
2026-02-07 22:28:56 +00:00
parent 8a28a27282
commit e938eef740
3 changed files with 8 additions and 8 deletions

View File

@@ -60,7 +60,9 @@ const LocationSearch = memo((props) => {
// Also ignore clicks on color input labels and wrappers
const target = event.target;
if (target.tagName === 'LABEL' && target.htmlFor) {
const associatedInput = document.getElementById(target.htmlFor) || document.querySelector(`input[name="${target.htmlFor}"]`);
const associatedInput =
document.getElementById(target.htmlFor) ||
document.querySelector(`input[name="${target.htmlFor}"]`);
if (associatedInput && associatedInput.type === 'color') {
return;
}

View File

@@ -176,13 +176,11 @@ const Modals = () => {
} else if (action === false && type === 'mainModal') {
// Mark modal as closing to prevent sync logic from interfering
setIsModalClosing(true);
// Wait for close animation and cleanup to complete, then navigate
setTimeout(() => {
// Navigate immediately to avoid URL flash
navigate('/');
// Reset the closing flag after navigation
// Wait for close animation to complete, then reset closing flag
setTimeout(() => {
setIsModalClosing(false);
}, 100);
}, 350);
}
};