I have a section of code that is contained in a link, the problem is that when I focus the element with NVDA
the content of the link is read all at once.
For example I have this code:
<a href="example.html" title="description link">
<h2>Heading H2</h2>
<span>More Text</span>
<p>More text</p>
</a>
And when I focus the link with NVDA
and Firefox the screen reader mention all the content of the h2
, span
and p
tags without press the arrow down key.
Ideally, when focusing on the link just read the title of the link and when you press the down arrow key the rest of the content is read
<a>
) it announces the contents as a 'label' (or 'accessible name') for that element. The behaviour you are calling for is more for non-interactive content (so-called "browse mode"). Do you really want/need all of that content inside the link? The 'link' semantics of<a>
will override the heading and paragraph semantics of the elements inside, so theh2
andp
markup is redundant! What is the actual use case? – brennanyoung