Starting from version 3.1.1, the proposed solutions no longer work, as fixed elements are no longer part of the list of children.
commit
Originally posted by @comhon-project in #3477 (comment)
The issue is that the begin_page_reflow event is called before the positioned elements are inserted into the current page. Suggested resolution would be to move that event below the element insertion.