When I ran my test, I set it dynamically (example provided below). The reason I needed to do this was because in your example you are changing the visibility at runtime. This means that the default setting will no longer be “Self Hit Test Invisible” for the canvas panel after you set it to “visible”.
Example:
