Back to home
Display A, announce B - button content
Developers may wish to display one piece of content, but replace it with other content for screen reader users - such as replacing a "Close" icon - an "X" with a more descriptive alternative.
Option 1: Button content - aria-hidden="true"
Test
Screen readers should only read out the different content, not the visibly displayed content - "Close and return to account details".
Example
x
Close and return to account details
Code sample
<button type="button">
<span aria-hidden="true">x</span>
<span class="sr-only">Close and return to account details</span>
</button>
Support chart
OS
Browser
NVDA 2014.4
JAWS 16
VoiceOver
Windows 7
IE 11
FAIL - reads both
PASS
Windows 7
IE 8
FAIL - reads both
PASS
Windows 7
Chrome 39
PASS
PASS
Windows 7
Firefox 34
PASS
FAIL - reads both
OSX 10.9
Chrome 39
PASS
OSX 10.9
Firefox 34
FAIL - reads both
OSX 10.9
Safari 7
PASS
Option 2: Button content - role="presentation"
Test
Screen readers should only read out the different content, not the visibly displayed content - "Close and return to account details".
Example
x
Close and return to account details
Code sample
<button type="button">
<span role="presentation">x</span>
<span class="sr-only">Close and return to account details</span>
</button>
Support chart
OS
Browser
NVDA 2014.4
JAWS 16
VoiceOver
Windows 7
IE 11
FAIL - reads both
FAIL - reads both
Windows 7
IE 8
FAIL - reads both
FAIL - reads both
Windows 7
Chrome 39
FAIL - reads both
FAIL - reads both
Windows 7
Firefox 34
FAIL - reads both
FAIL - reads both
OSX 10.9
Chrome 39
FAIL - reads both
OSX 10.9
Firefox 34
FAIL - reads both
OSX 10.9
Safari 7
FAIL - reads both
Option 3: Button content - aria-label=""
Test
Screen readers should only read out the different content, not the visibly displayed content - "Close and return to account details".
Example
x
Code sample
<button type="button" aria-label="Close and return to account details">
x
</button>
Support chart
OS
Browser
NVDA 2014.4
JAWS 16
VoiceOver
Windows 7
IE 11
PASS
PASS
Windows 7
IE 8
PASS
PASS
Windows 7
Chrome 39
PASS
PASS
Windows 7
Firefox 34
PASS
PASS
OSX 10.9
Chrome 39
PASS
OSX 10.9
Firefox 34
PASS
OSX 10.9
Safari 7
PASS
Bottom of page - Back to home