Skip to content

Commit

Permalink
DIT-439: Hints.
Browse files Browse the repository at this point in the history
- Added tabbing to tooltips and shows content of tooltip if tabbed to.
  • Loading branch information
EnvyPhD committed Dec 10, 2024
1 parent 7cbadbc commit b0be103
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/js/modules/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default (function() {
var tooltipSpan = document.createElement("span");
tooltipSpan.classList.add("tooltip");
tooltipSpan.id = "tooltip-" + count;

var textSpan = document.createElement("span");
textSpan.classList.add("tooltiptext-box");
textSpan.id = "tooltiptext-box-" + count;
Expand All @@ -46,14 +46,13 @@ export default (function() {
tooltipSpan.appendChild(underLineSpan);
tooltipSpan.appendChild(questionMarkSpan);
tooltipSpan.appendChild(textSpan);


el.innerHTML = el.innerHTML.replace(matches[0], tooltipSpan.outerHTML);
matches = re.exec(el.innerHTML);
count++;
}
for (var j = 0; j < count; j++) {
var tooltip = document.getElementById("tooltip-" + j);
tooltip.tabIndex = 1;
tooltip.addEventListener("click", function (e) {
e.stopPropagation();
var tooltipText = this.querySelector(".tooltiptext-box");
Expand Down
6 changes: 6 additions & 0 deletions src/vue/design/re-styles/tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
display: inline-flex;
}

.tooltip:focus-visible {
outline: 3px solid dimgray;
.tooltiptext-box {
display: inline !important;
}
}

.tooltip-underline {
border-bottom: 0.5px dashed #00468E;
Expand Down

0 comments on commit b0be103

Please sign in to comment.