Some things vanish the moment you press a key: a hover tooltip, an open menu, a drag in progress.
screencapture has a timer for that. -T waits a number of seconds before it takes the picture. The man page says the default is 5.
screencapture -T 5 ~/Desktop/menu.png
Run the command, switch to the app, open the menu and wait. Add -x if you do not want the camera sound.
screencapture -x -T 8 ~/Desktop/menu.png
Apple also puts a timer in the screenshot toolbar. Press Shift-Command-5, open Options and pick a delay. The command line version is useful in a script or over SSH sessions where you still have a logged in desktop.
One caveat: the terminal itself may be the thing on screen when the timer ends. Click away from it quickly, or you will get a nice picture of your own prompt.
The delay is also useful for things that need two hands. Start the timer, grab the mouse and the keyboard, and set up the shot while the countdown runs. It is a boring command, but it covers what the normal shortcut cannot.
Further reading: screencapture.1 man page, Take a screenshot or screen recording on Mac (Apple Support), On this site: screencapture -o -w grabs a window without the drop shadow, On this site: softwareupdate –list shows pending macOS updates without opening Settings