refactor context menu and keyboard navigation handling for improved clarity and maintainability
This commit is contained in:
@@ -1926,6 +1926,8 @@ useEffect(() => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const el = appRootRef.current;
|
||||||
|
if (!el) return;
|
||||||
function handleArrowKeyNavigation(e: KeyboardEvent) {
|
function handleArrowKeyNavigation(e: KeyboardEvent) {
|
||||||
console.log("Handling arrow key navigation", e.key);
|
console.log("Handling arrow key navigation", e.key);
|
||||||
console.log("activeViewport", activeViewport);
|
console.log("activeViewport", activeViewport);
|
||||||
@@ -1975,8 +1977,11 @@ useEffect(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("keydown", handleArrowKeyNavigation);
|
el.addEventListener("keydown", handleArrowKeyNavigation);
|
||||||
return () => window.removeEventListener("keydown", handleArrowKeyNavigation);
|
|
||||||
|
return () => {
|
||||||
|
el.removeEventListener("keydown", handleArrowKeyNavigation);
|
||||||
|
};
|
||||||
}, [activeViewport, viewportModes, viewportImageIds, updateOverlay]);
|
}, [activeViewport, viewportModes, viewportImageIds, updateOverlay]);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user