sidebar hovering problem

side bar won’t close if i click a sub choice

image

i made a while hovering to close the sidebar when not clicking anything

how can i make that sidebar close if i click a sub choice ?