The order of the previous picture and the next picture is incorrect

Nextcloud 23.0.0
The Nextcloud in my Server and in the demo (https://demo2.nextcloud.com) have the same problem.

The pictures are sorted in reverse order according to the modified date:
捕获

I click one picture to preview,

When I click the right button, it should display picture 4, but in fact it display picture 5.

Why the left and right buttons do not achieve the expected effect?