Skip to content
Snippets Groups Projects
Commit 0623b6ac authored by Moritz Strohm's avatar Moritz Strohm Committed by Jan-Hendrik Willms
Browse files

added tabindex for tooltips generated by tooltip2 or tooltipIcon functions

parent c7acb138
No related branches found
No related tags found
No related merge requests found
...@@ -623,6 +623,7 @@ function tooltip2($text, $with_alt = TRUE, $with_popup = FALSE) { ...@@ -623,6 +623,7 @@ function tooltip2($text, $with_alt = TRUE, $with_popup = FALSE) {
$ret['alt'] = $text; $ret['alt'] = $text;
} }
$ret['title'] = $text; $ret['title'] = $text;
$ret['tabindex'] = '0';
return $ret; return $ret;
} }
......
...@@ -10,10 +10,10 @@ var timeout = null; ...@@ -10,10 +10,10 @@ var timeout = null;
STUDIP.Tooltip.threshold = 6; STUDIP.Tooltip.threshold = 6;
$(document).on('mouseenter mouseleave', '[data-tooltip],.tooltip:has(.tooltip-content)', function(event) { $(document).on('mouseenter mouseleave focusin focusout', '[data-tooltip],.tooltip:has(.tooltip-content)', function(event) {
let data = $(this).data(); let data = $(this).data();
const visible = event.type === 'mouseenter'; const visible = event.type === 'mouseenter' || event.type === 'focusin';
const offset = $(this).offset(); const offset = $(this).offset();
const x = offset.left + $(this).outerWidth(true) / 2; const x = offset.left + $(this).outerWidth(true) / 2;
const y = offset.top; const y = offset.top;
...@@ -61,8 +61,8 @@ $(document).on('mouseenter mouseleave', '[data-tooltip],.tooltip:has(.tooltip-co ...@@ -61,8 +61,8 @@ $(document).on('mouseenter mouseleave', '[data-tooltip],.tooltip:has(.tooltip-co
} else { } else {
timeout = setTimeout(() => data.tooltipObject.hide(), delay); timeout = setTimeout(() => data.tooltipObject.hide(), delay);
} }
}).on('mouseenter', '.studip-tooltip', () => { }).on('mouseenter focusin', '.studip-tooltip', () => {
clearTimeout(timeout); clearTimeout(timeout);
}).on('mouseleave', '.studip-tooltip', function() { }).on('mouseleave focusout', '.studip-tooltip', function() {
$(this).hide(); $(this).hide();
}); });
<span class="tooltip tooltip-icon <? if ($important) echo 'tooltip-important'; ?>" data-tooltip <? if (!$html) printf('title="%s"', htmlReady($text)) ?>> <span class="tooltip tooltip-icon <? if ($important) echo 'tooltip-important'; ?>" data-tooltip <? if (!$html) printf('title="%s"', htmlReady($text)) ?> tabindex="0">
<? if ($html): ?> <? if ($html): ?>
<span class="tooltip-content"><?= $text ?></span> <span class="tooltip-content"><?= $text ?></span>
<? endif; ?> <? endif; ?>
......
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