Another trick you can do is to add a very large (big as the biggest screen your game will ever be on), centered, center-anchor, fully visible Border component to the background of the Widget blueprint that goes on top, and set its alpha to 0. This intercepts clicks from going through to anything behind it.
‘s way is best, as this one can fail in some scenarios, but this way saves you the trouble of switching other widgets’ visibility back and forth. I use this technique to re-set focus on buttons if the user clicks outside of any of them, to keep gamepad navigation working when both mouse and gamepad are allowed to navigate.