Screen reader output as expected
Source: tweet by Steve Faulkner
By the way, don't use the title attribute as seen in this example. Your screen reader might have different output for the title-attribute.
-
HTML says
<a href="#">hello</a>
-
Screen reader says
hello
-
HTML says
<a href="#" title="goodbye">hello</a>
-
Screen reader says
hello goodbye
-
HTML says
<a href="#" aria-label="goodbye">hello</a>
-
Screen reader says
goodbye
-
HTML says
<a href="#" aria-label="goodbye"></a>
-
Screen reader says
goodbye
-
HTML says
<a href="#" title="goodbye"></a>
-
Screen reader says
goodbye
-
HTML says
<a href="#" aria-label="goodbye" aria-labelledby="hi">
hello <span id="hi">hello</span></a>
-
Screen reader says
hello
Enter message