How to make sticky/fixed overlays work in Confluence Global Page Custom UI? (position:fixed not working)

The only “solution” I found was from candid who posted this solution a couple years back: Sticky toolbar inside an Atlassian Connect iframe

But this isn’t ideal as there is considerable lag time from the user scrolling to the “stickied” element updating its position, resulting in a bad UX. We didn’t end up going with this route and just decided to forego stickied elements; though our app didn’t really need a stickied element anyways.