diff --git a/client/src/components/Minimap/Minimap.tsx b/client/src/components/Minimap/Minimap.tsx index 5cbda99cf8..7d7fa100b8 100644 --- a/client/src/components/Minimap/Minimap.tsx +++ b/client/src/components/Minimap/Minimap.tsx @@ -8,6 +8,7 @@ import React, { import { debounce } from '../../utils/debounce'; import { gettext } from '../../utils/gettext'; +import { toggleCollapsiblePanel } from '../../includes/panels'; import Icon from '../Icon/Icon'; import CollapseAll from './CollapseAll'; @@ -127,11 +128,13 @@ const Minimap: React.FunctionComponent = ({ const listRef = useRef(null); const onClickToggle = () => toggleMinimap(!expanded); - const onClickLink = (e: React.MouseEvent) => { + const onClickLink = (link: MinimapMenuItem, e: React.MouseEvent) => { // Prevent navigating if the link is only partially shown. if (!expanded) { e.preventDefault(); } + + toggleCollapsiblePanel(link.toggle, true); toggleMinimap(true); }; diff --git a/client/src/components/Minimap/MinimapItem.tsx b/client/src/components/Minimap/MinimapItem.tsx index e6c6c2db3f..6b767820f4 100644 --- a/client/src/components/Minimap/MinimapItem.tsx +++ b/client/src/components/Minimap/MinimapItem.tsx @@ -19,7 +19,7 @@ interface MinimapItemProps { item: MinimapMenuItem; intersects: boolean; expanded: boolean; - onClick: (e: React.MouseEvent) => void; + onClick: (item: MinimapMenuItem, e: React.MouseEvent) => void; } const requiredMark = *; @@ -47,7 +47,7 @@ const MinimapItem: React.FunctionComponent = ({ className={`w-minimap-item w-minimap-item--${level} ${ intersects ? 'w-minimap-item--active' : '' } ${hasError ? 'w-minimap-item--error' : ''}`} - onClick={onClick} + onClick={onClick.bind(null, item)} aria-current={intersects} // Prevent interacting with the links when they are only partially shown. tabIndex={expanded ? undefined : -1}