When the primary screen has offset the popup menus are moved by this offset all the time:
[(null) 27130: Main Thread]: D/WidgetScreen New screen [0 2880 3840 2160 (0 2880 3840 2160) 32 2.000000 2.000000 288.757874]
[(null) 27130: Main Thread]: D/WidgetScreen New screen [527 0 2560 1440 (527 0 2560 1440) 32 1.000000 1.000000 117.987099] <- this is primary screen
This is because no GTK app knows on which monitor it is located in Wayland (ie. its absolute position), so the Firefox's ScreenManager returns the primary monitor all the time and in the nsMenuPopupFrame::SetPopupPosition the offset is used to ensure that menu is shown on monitor:
// Ensure that anchorRect is on screen.
anchorRect = anchorRect.Intersect(screenRect);
The Firefox needs to stop adjusting popup position in Wayland because it does not work and it should be executed by gdk_window_move_to_rect() which ensures the popup is shown in visible area.