I’ve experienced I need to have the cursor over the nodes or viewer area for it to work. Occasionally it doesn’t matter where the cursor is.
However, you can add the shortcut to another key, which will be that key only to toggle between on/off. What you do is System Preferences -> Keyboard -> Keyboard Shortcuts -> Add DaVinci Resolve to the apps list -> Write the exact menu item (remember CAPITAL LETTERS and any signs like “/”) and press a key to make this one do the job for you. Works like a charm. 🙂