Raycast Target does not block mouse click

I have a 2D game with the play field on the default canvas (z = 0.5). The UI buttons are on another canvas on z = 0.0. I want to prevent mouse clicks from going through to the UI buttons after the player has won the game, so I cover the entire screen with a UI Text (enabled when the player has won the game)

I tried

  1. Adding a UI Text on the default canvas.
  2. Adding a UI Text on the UI buttons canvas.
  3. Adding another canvas (z = -0.5) and make the UI Text a child object to this canvas.

For all 3 options, the Raycast Target option is checked. However, the UI buttons are still clickable.

Appreciate any advice on this issue.

Thank you!

Use this assertion in the same if statement as the raycast:
PS: change -1 to 0 for mobile