MDL-64819 output: Hide icons with no title
authorDamyon Wiese <damyon@moodle.com>
Mon, 8 Apr 2019 07:39:02 +0000 (15:39 +0800)
committerSara Arjona <sara@moodle.com>
Mon, 8 Apr 2019 12:34:15 +0000 (14:34 +0200)
When output from javascript they should match what gets output from php.

lib/amd/build/icon_system_fontawesome.min.js
lib/amd/build/icon_system_standard.min.js
lib/amd/src/icon_system_fontawesome.js
lib/amd/src/icon_system_standard.js

index 2a6fd40..9b9bcf3 100644 (file)
Binary files a/lib/amd/build/icon_system_fontawesome.min.js and b/lib/amd/build/icon_system_fontawesome.min.js differ
index d165a79..4591141 100644 (file)
Binary files a/lib/amd/build/icon_system_standard.min.js and b/lib/amd/build/icon_system_standard.min.js differ
index 970b0b9..5ef205a 100644 (file)
@@ -105,6 +105,10 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
             unmappedIcon: unmappedIcon
         };
 
+        if (typeof title === "undefined" || title === '') {
+            context['aria-hidden'] = true;
+        }
+
         var result = Mustache.render(template, context);
         return result.trim();
     };
index 5162454..a1bce77 100644 (file)
@@ -52,6 +52,10 @@ define(['core/icon_system', 'core/url', 'core/mustache'],
                 {name: 'title', value: title}
             ]
         };
+        if (typeof title === "undefined" || title == "") {
+            templatecontext.attributes.push({name: 'aria-hidden', value: 'true'});
+        }
+
         var result = Mustache.render(template, templatecontext);
         return result.trim();
     };