Skip to content

Commit

Permalink
1-3073: close sidebar when you click a link within it (#8763)
Browse files Browse the repository at this point in the history
This change makes it so that the project status sidebar will close
when you follow a link within it. We do that by using JS event
bubbling and attaching a handler on the modal parent. We can listen
for events and check whether the target is an anchor and, if so, close
the modal.
  • Loading branch information
thomasheartman authored Nov 15, 2024
1 parent 1af204e commit 2014d36
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ const CloseRow = styled('div')(({ theme }) => ({

export const ProjectStatusModal = ({ open, close }: Props) => {
return (
<DynamicSidebarModal open={open} onClose={close} label='Project status'>
<DynamicSidebarModal
open={open}
onClose={close}
label='Project status'
onClick={(e: React.SyntheticEvent) => {
if (e.target instanceof HTMLAnchorElement) {
close();
}
}}
>
<ModalContentContainer>
<HeaderRow>
<StyledProjectStatusSvg aria-hidden='true' />
Expand Down

0 comments on commit 2014d36

Please sign in to comment.