Resize page to selection uses wrong origin (items offset from y=0) if y axis pointing up

See screenshots below. These are from Inkscape 1.2. This is likely a regression from 1.1 series. When resizing the page to the selected items, the items on the page are offset vertically relative to the page origin.

Example source image:

1._Source

After resize to selection:

2._After_resize_to_selection

Edited by Nathan Lee