Skip to content
Snippets Groups Projects
Commit aea383ff authored by Elmar Ludwig's avatar Elmar Ludwig Committed by David Siegfried
Browse files

add aria role for JS tooltips, fixes #1916

Closes #1916

Merge request studip/studip!1314
parent 29604e0e
No related branches found
No related tags found
No related merge requests found
...@@ -35,12 +35,13 @@ $(document).on('mouseenter mouseleave focusin focusout', '[data-tooltip],.toolti ...@@ -35,12 +35,13 @@ $(document).on('mouseenter mouseleave focusin focusout', '[data-tooltip],.toolti
if (!content) { if (!content) {
content = $(this).find('.tooltip-content').remove().html(); content = $(this).find('.tooltip-content').remove().html();
} }
$(this).attr('title', ''); $(this).attr('title', null);
$(this).attr('data-tooltip', content); $(this).attr('data-tooltip', content);
tooltip = new STUDIP.Tooltip(x, y, content); tooltip = new STUDIP.Tooltip(x, y, content);
data.tooltipObject = tooltip; data.tooltipObject = tooltip;
$(this).attr('aria-describedby', tooltip.id);
$(this).on('remove', function() { $(this).on('remove', function() {
tooltip.remove(); tooltip.remove();
......
...@@ -66,6 +66,7 @@ class Tooltip { ...@@ -66,6 +66,7 @@ class Tooltip {
this.element = $('<div>'); this.element = $('<div>');
this.element.addClass(css_class || 'studip-tooltip'); this.element.addClass(css_class || 'studip-tooltip');
this.element.attr('id', this.id); this.element.attr('id', this.id);
this.element.attr('role', 'tooltip');
this.element.appendTo('body'); this.element.appendTo('body');
// Set position and content and paint the tooltip // Set position and content and paint the tooltip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment