From b1ccaf8903983fc5da2082d7dcdfd3630037aca1 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sat, 3 Aug 2019 11:52:51 +0000 Subject: [PATCH] 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 --- src/js/_enqueues/wp/emoji.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/js/_enqueues/wp/emoji.js b/src/js/_enqueues/wp/emoji.js index b2c8e1a15a..27882d1e27 100644 --- a/src/js/_enqueues/wp/emoji.js +++ b/src/js/_enqueues/wp/emoji.js @@ -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' );