@Welcome to the forum @terasa and thank you for your question.
Please be careful as using # on this forum has a purpose: it is to create a link to a tag. Therefore, could you please edit your post if your can and enclose your code in backticks ```#rect``` or simply `#rect` to avoid things such as #box becoming box?
I have taken the liberty to rephrase the title of your post to a question, as per our guidelines: How to post in the Questions category. Feel free to change it to your liking. I have also tagged your post with accessibility.
Thanks ;)
Edit:
- To which PDF standard are you validating against? See PDF – Typst Documentation
- Have you tried / can you use PDF/UA-1?
- Also see Typst: Typst 0.14: Now accessible – Typst Blog
- If you suspect a bug, you can report it