How to have just the topmost game object receive pointer events?

Working on a game which has some UI overlays which can appear over the main game map. I’ve been adding .setInteractive().on('pointerup', ...) listeners on GameObjects to handle mouse clicks, but hit a problem where if the UI overlay happens to overlap part of the map that can also be interacted with, both receive a pointer event. Is there a way to set it up so that only the top-most GameObject can receive pointer events? The default value of input.topOnly (https://photonstorm.github.io/phaser3-docs/Phaser.Input.InputPlugin.html#topOnly) sounds like the behaviour I want, but doesn’t appear to behave as I hoped.

InputPlugin#setGlobalTopOnlyInputManager#globalTopOnly should control that, but its default value is also true, so I’m not sure what’s going on.