Accessibility: Improve the way emojis are announced by screen readers.

Adds an ARIA `role="img"` to the emojis markup in the front end. While the ARIA role is technically redundant, it helps Safari and VoiceOver to properly announce the emojis as "image". Without the role, they announce a generic "group" role.
Tested with Safari 12.1.1 / VoiceOver 9.

Props pento.
See #37486.


git-svn-id: https://develop.svn.wordpress.org/trunk@45726 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2019-08-03 11:52:51 +00:00
parent 101fd0647c
commit b1ccaf8903
1 changed files with 5 additions and 0 deletions

View File

@ -253,6 +253,11 @@
return ''.concat( options.base, icon, options.ext );
},
attributes: function() {
return {
role: 'img'
};
},
onerror: function() {
if ( twemoji.parentNode ) {
this.setAttribute( 'data-error', 'load-failed' );