Should a popup get closed if the user scrolls the area behind it?

In the image below, the sidebar (Blue) is a scrollable container that has input-fields, check boxes and a color-picker (yellow). When the user clicks the color-picker button, a pop-up dialog shows up (green).

Should this pop-up get automatically closed when the user scrolls the area behind it (blue), or when the application's page gets resized?

If yes, does this behavior meet users' expectations? Won't this cause the user to loose focus on the controller (color picker)?

Illustration