Custom marker showing children randomly

Hello! I have a CustomMarker that displays Marker and another component, it looks like this

So when you hover over the marker it displays the component. The problem that it doesn’t count whether it an edge of the map or no, so sometimes this could happen
Also there is a problem. As you can see on the first screenshot the component renders below the marker and if a click on marker and keep hovering then it’s displaying on top of it. I don’t know why the behavior is like this, but if you set pop-up component’s position to ‘absolute’ it will now be displayed only below the marker.

My questions are: Is it supposed to behave like this? How can tell algolia to render it within map, without crop?

Thanks in advance!