Disable right mouse button look when in widget (when input is set to game and UI)

Hi, how do you disable looking around with right mouse button pressed, when a widget is open. Thanks.