Skip to content

Commit

Permalink
Fixed issue #09128: Using screen readers JAWS and NVDA, image menu ar…
Browse files Browse the repository at this point in the history
…e unreadable

Dev: don't remove alt on image, but set a data to hasqtip
  • Loading branch information
Shnoulle committed Jul 5, 2014
1 parent 4a0edc8 commit 0e12d75
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions scripts/admin/admin_core.js
Expand Up @@ -255,26 +255,29 @@ function doToolTip()
});
}
});
$(".sf-menu a > img[alt]").removeAttr("alt");
$(".sf-menu a > img[alt]").data("hasqtip", true ).parent("a").data("hasqtip", true );
$("a").each(function() {
tipcontent=$(this).children("img").attr('alt');
if(!tipcontent){tipcontent=htmlEncode($(this).attr('title'));}
if(tipcontent && tipcontent!=""){
$(this).qtip({
content: {
text: tipcontent
},
style: {
classes: "qtip-light qtip-rounded"
},
position: {
viewport: $(window),
at: 'bottom right'
}
});
if(!$(this).data("hasqtip"))// data-hasqtip not in DOM, then need to be tested directly (:not([data-hasqtip]) don't work)
{
tipcontent=$(this).children("img").attr('alt');
if(!tipcontent){tipcontent=htmlEncode($(this).attr('title'));}
if(tipcontent && tipcontent!=""){
$(this).qtip({
content: {
text: tipcontent
},
style: {
classes: "qtip-light qtip-rounded"
},
position: {
viewport: $(window),
at: 'bottom right'
}
});
}
}
});
$("a > img[alt]").removeAttr("alt");
$("a > img[alt]").data("hasqtip", true );

// Call the popuptip hover rel attribute
$('.popuptip').each(function(){
Expand All @@ -299,7 +302,7 @@ function doToolTip()
event: "mouseout"
}
});
$("#"+$(this).attr('rel')).find("img").removeAttr("alt"); // Remove children img attr alt, the default tooltip can apply.
$("#"+$(this).attr('rel')).find("img").data("hasqtip", true );
}
});
// On label
Expand All @@ -319,7 +322,7 @@ function doToolTip()
});
// Loads the tooltips on image
$('img[alt],input[src]').each(function() {
if($(this).attr('alt') != ''){
if($(this).attr('alt') != '' && !$(this).data("hasqtip")){
$(this).qtip({
content: {
attr: "alt"
Expand Down

0 comments on commit 0e12d75

Please sign in to comment.