How to achieve conditional visibility of content based on it's location on the page (e.g. if it's at the top of the page)?

Let’s say I have the following content function that I call multiple times in my multi-page document:

#let myText = [
  #v(1em) \
  #lorem(5)
]

I would like for the space function #v(1em) to not be visible whenever #myText occurs at the top of a page right after a page break, for consistent margins. I thought I could use #context with #if here().position().y != page.margin.top.length as a conditional for visibility of the space:

#let myText = context[
  #if here().position().y != page.margin.top.length [ 
    #v(1em)
  ]
  #lorem(5)
]

However, here().position().y and page.margin.top.length do not match:

#set page(
  width: 2in,
  height: 2in,
  margin: (x: 0.4in, top: 0.4in, bottom: 0.6in),
)

#context here().position().y \
#context page.margin.top.length

It seems like here().position().y is based on the baseline of the text content. When I set a larger text size for the document, the position value changes. Is there a way to refer to the top left corner of the “bounding box” instead of the baseline position?

Or is there another way of conditionally hiding content if it occurs at the start of a page?

Using the weak parameter of h() might be enough for your requirements:

If true, the spacing collapses at the start or end of a paragraph. Moreover, from multiple adjacent weak spacings all but the largest one collapse.