1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-29 01:15:48 +02:00

1-3073: close sidebar when you click a link within it (#8763)

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.
This commit is contained in:
Thomas Heartman 2024-11-15 08:36:22 +01:00 committed by GitHub
parent 1af204e0f0
commit 2014d367f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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' />