Stop camera and use mouse

I have a game where it shows a spell screen once u press Enter, then u can select one of the spells with left mouse.

What happens right now is that the spell menu shows but the camera still moves with the mouse, I have to click on the spell menu once for the camera to stop and for the mouse to start moving freely.
Same thing when closing the Spell Menu.

Is there a way to like, refresh it after opening menu?

I noticed that when I run the show cursor function in Breakpoint mode, everything goes perfect. So I assumed a refresh is needed