mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-40759 icons: Keep separate alt/title
For font awesome icons I had only supported one of alt/title. This was because (subjectively) we have done a terrible job of providing meaningful alt text for icons. This is not a good idea and not backwards compatible so I have put it back again. Fingers crossed I did not break 1000 behats.
This commit is contained in:
parent
3e6adcd69c
commit
1caabd8468
2
lib/amd/build/icon_system_fontawesome.min.js
vendored
2
lib/amd/build/icon_system_fontawesome.min.js
vendored
@ -1 +1 @@
|
||||
define(["core/icon_system","jquery","core/ajax","core/mustache","core/localstorage"],function(a,b,c,d,e){var f=null,g=null,h=function(){a.apply(this,arguments)};return h.prototype=Object.create(a.prototype),h.prototype.init=function(){if(f)return b.when(this);var a=e.get("core/iconmap-fontawesome");return a&&(a=JSON.parse(a)),a?(f=a,b.when(this)):(null===g&&(g=c.call([{methodname:"core_output_load_fontawesome_icon_map",args:[]}],!0,!1)[0]),g.then(function(a){return f={},b.each(a,function(a,b){f[b.component+"/"+b.pix]=b.to}.bind(this)),e.set("core/iconmap-fontawesome",JSON.stringify(f)),this}.bind(this)))},h.prototype.renderIcon=function(a,b,c,e){var g=f[b+"/"+a];"undefined"==typeof g&&(g=b+"/"+a);var h={key:g,title:c};return d.render(e,h)},h.prototype.getTemplateName=function(){return"core/pix_icon_fontawesome"},h});
|
||||
define(["core/icon_system","jquery","core/ajax","core/mustache","core/localstorage"],function(a,b,c,d,e){var f=null,g=null,h=function(){a.apply(this,arguments)};return h.prototype=Object.create(a.prototype),h.prototype.init=function(){if(f)return b.when(this);var a=e.get("core/iconmap-fontawesome");return a&&(a=JSON.parse(a)),a?(f=a,b.when(this)):(null===g&&(g=c.call([{methodname:"core_output_load_fontawesome_icon_map",args:[]}],!0,!1)[0]),g.then(function(a){return f={},b.each(a,function(a,b){f[b.component+"/"+b.pix]=b.to}.bind(this)),e.set("core/iconmap-fontawesome",JSON.stringify(f)),this}.bind(this)))},h.prototype.renderIcon=function(a,b,c,e){var g=f[b+"/"+a];"undefined"==typeof g&&(g=b+"/"+a);var h={key:g,title:c,alt:c};return d.render(e,h)},h.prototype.getTemplateName=function(){return"core/pix_icon_fontawesome"},h});
|
@ -91,7 +91,8 @@ define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/locals
|
||||
|
||||
var context = {
|
||||
key: mappedIcon,
|
||||
title: title
|
||||
title: title,
|
||||
alt: title
|
||||
};
|
||||
|
||||
return Mustache.render(template, context);
|
||||
|
@ -575,12 +575,14 @@ class pix_icon_font implements templatable {
|
||||
$pixdata = $this->pixicon->export_for_template($output);
|
||||
|
||||
$title = isset($this->pixicon->attributes['title']) ? $this->pixicon->attributes['title'] : '';
|
||||
$alt = isset($this->pixicon->attributes['alt']) ? $this->pixicon->attributes['alt'] : '';
|
||||
if (empty($title)) {
|
||||
$title = isset($this->pixicon->attributes['alt']) ? $this->pixicon->attributes['alt'] : '';
|
||||
$title = $alt;
|
||||
}
|
||||
$data = array(
|
||||
'extraclasses' => $pixdata['extraclasses'],
|
||||
'title' => $title,
|
||||
'alt' => $alt,
|
||||
'key' => $this->key
|
||||
);
|
||||
|
||||
|
@ -36,8 +36,9 @@
|
||||
{
|
||||
"key": "fa-meh-o",
|
||||
"title": "Meh",
|
||||
"alt": "Meh Meh",
|
||||
"extraclasses": "fa-spin"
|
||||
}
|
||||
|
||||
}}
|
||||
<i class="icon fa {{key}} fa-fw {{extraclasses}}" aria-hidden="true" title="{{title}}" aria-label="{{title}}"></i>
|
||||
<i class="icon fa {{key}} fa-fw {{extraclasses}}" aria-hidden="true" title="{{title}}" aria-label="{{alt}}"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user