From aea383ff2bd1b576f091aacd105d6886c83f7d86 Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Thu, 16 Mar 2023 15:00:56 +0000 Subject: [PATCH] add aria role for JS tooltips, fixes #1916 Closes #1916 Merge request studip/studip!1314 --- resources/assets/javascripts/bootstrap/tooltip.js | 3 ++- resources/assets/javascripts/lib/tooltip.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/assets/javascripts/bootstrap/tooltip.js b/resources/assets/javascripts/bootstrap/tooltip.js index c2493cf7456..c84042b8253 100644 --- a/resources/assets/javascripts/bootstrap/tooltip.js +++ b/resources/assets/javascripts/bootstrap/tooltip.js @@ -35,12 +35,13 @@ $(document).on('mouseenter mouseleave focusin focusout', '[data-tooltip],.toolti if (!content) { content = $(this).find('.tooltip-content').remove().html(); } - $(this).attr('title', ''); + $(this).attr('title', null); $(this).attr('data-tooltip', content); tooltip = new STUDIP.Tooltip(x, y, content); data.tooltipObject = tooltip; + $(this).attr('aria-describedby', tooltip.id); $(this).on('remove', function() { tooltip.remove(); diff --git a/resources/assets/javascripts/lib/tooltip.js b/resources/assets/javascripts/lib/tooltip.js index 5ae28edfd20..2cdac27be88 100644 --- a/resources/assets/javascripts/lib/tooltip.js +++ b/resources/assets/javascripts/lib/tooltip.js @@ -66,6 +66,7 @@ class Tooltip { this.element = $('<div>'); this.element.addClass(css_class || 'studip-tooltip'); this.element.attr('id', this.id); + this.element.attr('role', 'tooltip'); this.element.appendTo('body'); // Set position and content and paint the tooltip -- GitLab