Right click on Brave/Firefox and see a black border/red border

I’d account for different software implementing their menus their own way. The black background is, as I suppose, when an application tries to draw a fancy composited shadow, but the black filling is due to how the graphics get sanitized. I showcased a similar thing here.

With Firefox I suppose the implementation is different, so that it redraws a visible area as part of the menu windows, on which it then tries to draw the actual menu, faking the transparency. You can try this on your own by dragging the main Firefox window after spawning such a menu and see if the background of the menu changes in real-time.