Inline headers, spacing, and accessibility tags

I’m running into an interesting issue with inline headers and accessibility tags (PDF/UA-1 document mode). Using simple inline styling works, e.g.

#show heading.where(level: 2): it => {
  box(strong(it.body))
  h(0.5em)
}

#set document(title: "Test document")

= Main header

== Inline header 
#lorem(100)

But adding vertical space before the header errors out with “PDF/UA-1 error: invalid document structure, this element’s PDF tag would be split up”

#show heading: it => {
  v(1em, weak: true)
  it
}

I suppose adding the space breaks the paragraph flow , and the tag applies at the wrong level of the structure… Is a way to work around this?