mirror of
https://github.com/mue/mue.git
synced 2026-06-08 14:10:42 +02:00
fix: Refactor event handling in LocationSearch and streamline modal navigation logic in Modals
This commit is contained in:
@@ -60,7 +60,9 @@ const LocationSearch = memo((props) => {
|
|||||||
// Also ignore clicks on color input labels and wrappers
|
// Also ignore clicks on color input labels and wrappers
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
if (target.tagName === 'LABEL' && target.htmlFor) {
|
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') {
|
if (associatedInput && associatedInput.type === 'color') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,13 +176,11 @@ const Modals = () => {
|
|||||||
} else if (action === false && type === 'mainModal') {
|
} else if (action === false && type === 'mainModal') {
|
||||||
// Mark modal as closing to prevent sync logic from interfering
|
// Mark modal as closing to prevent sync logic from interfering
|
||||||
setIsModalClosing(true);
|
setIsModalClosing(true);
|
||||||
// Wait for close animation and cleanup to complete, then navigate
|
// Navigate immediately to avoid URL flash
|
||||||
|
navigate('/');
|
||||||
|
// Wait for close animation to complete, then reset closing flag
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
navigate('/');
|
setIsModalClosing(false);
|
||||||
// Reset the closing flag after navigation
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsModalClosing(false);
|
|
||||||
}, 100);
|
|
||||||
}, 350);
|
}, 350);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user