From fc6316433520b14187b67680de266790aa9e44a3 Mon Sep 17 00:00:00 2001 From: kempersc Date: Tue, 13 Jan 2026 18:22:49 +0100 Subject: [PATCH] fix: close ontology popup when navigating to different LinkML schema files When users click on a different class, enum, or slot in the sidebar, the ontology term popup now automatically closes. This prevents the popup from persisting and showing stale information from the previously viewed schema element. --- frontend/src/pages/LinkMLViewerPage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/LinkMLViewerPage.tsx b/frontend/src/pages/LinkMLViewerPage.tsx index 1ba6b5135a..e17a948d3f 100644 --- a/frontend/src/pages/LinkMLViewerPage.tsx +++ b/frontend/src/pages/LinkMLViewerPage.tsx @@ -1691,6 +1691,8 @@ const LinkMLViewerPage: React.FC = () => { const navigateToClass = useCallback((className: string) => { setSearchParams({ class: className }); setHighlightedClass(className); + // Close any open ontology popup when navigating + setOntologyPopupCurie(null); // Find and select the class file const classFile = categories @@ -1708,6 +1710,8 @@ const LinkMLViewerPage: React.FC = () => { const navigateToEnum = useCallback((enumName: string) => { setSearchParams({ enum: enumName }); setHighlightedClass(enumName); // Reuse highlight state for enums + // Close any open ontology popup when navigating + setOntologyPopupCurie(null); // Find and select the enum file const enumFile = categories @@ -1725,6 +1729,8 @@ const LinkMLViewerPage: React.FC = () => { const navigateToSlot = useCallback((slotName: string) => { setSearchParams({ slot: slotName }); setHighlightedClass(slotName); // Reuse highlight state for slots + // Close any open ontology popup when navigating + setOntologyPopupCurie(null); // Find and select the slot file const slotFile = categories @@ -3654,8 +3660,9 @@ const LinkMLViewerPage: React.FC = () => { } else if (category.name === 'slot') { navigateToSlot(file.name); } else { - // For main schemas, clear the deep link params + // For main schemas, clear the deep link params and close any popup setSearchParams({}); + setOntologyPopupCurie(null); } }} >