Skip to content

Commit

Permalink
Use keyboard styling for shortcuts in tooltips (close #6574)
Browse files Browse the repository at this point in the history
Make tooltips less transparent
  • Loading branch information
quincylvania committed Jun 24, 2019
1 parent 61407a5 commit a579e35
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
34 changes: 18 additions & 16 deletions css/80_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ a:visited, a {
a:hover {
color: #597be7;
}
kbd {
display: inline-block;
text-align: center;
padding: 3px 5px;
font-size: 11px;
line-height: 12px;
min-width: 12px;
vertical-align: baseline;
background-color: #fcfcfc;
border: solid 1px #ccc;
margin: 0 2px;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}

/* Forms
------------------------------------------------------- */
Expand Down Expand Up @@ -5113,20 +5128,7 @@ img.tile-debug {
}

.modal-shortcuts .shortcut-keys kbd {
display: inline-block;
text-align: center;
padding: 3px 5px;
font-size: 11px;
line-height: 12px;
min-width: 12px;
color: #555;
vertical-align: baseline;
background-color: #fcfcfc;
border: solid 1px #ccc;
margin: 0 2px;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}

svg.mouseclick use.left {
Expand Down Expand Up @@ -5355,7 +5357,7 @@ svg.mouseclick use.right {
pointer-events: none;
}
.tooltip.in {
opacity: 0.9;
opacity: 0.95;
z-index: 5000;
height: auto;
display: block;
Expand Down Expand Up @@ -5490,12 +5492,12 @@ svg.mouseclick use.right {
.tooltip-inner .tooltip-text {
margin-bottom: 20px;
}
.tooltip-inner .keyhint {
.tooltip-inner .shortcut {
font-weight: bold;
margin-left: 5px;
}

[dir='rtl'] .tooltip-inner .keyhint {
[dir='rtl'] .tooltip-inner .shortcut {
margin-left: 0;
margin-right: 5px;
}
Expand Down
12 changes: 8 additions & 4 deletions modules/ui/tooltipHtml.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { t } from '../util/locale';


export function uiTooltipHtml(text, key, heading) {
export function uiTooltipHtml(text, keys, heading) {
var s = '';

if (heading) {
Expand All @@ -10,9 +10,13 @@ export function uiTooltipHtml(text, key, heading) {
if (text) {
s += '<div class="tooltip-text"><span>' + text + '</span></div>';
}
if (key) {
s += '<div class="keyhint-wrap"><span>' + t('tooltip_keyhint') + '</span>' +
'<span class="keyhint">' + key + '</span></div>';
if (keys) {
if (!Array.isArray(keys)) keys = [keys];
s += '<div class="keyhint-wrap"><span>' + t('tooltip_keyhint') + '</span>';
keys.forEach(function(key) {
s += '<kbd class="shortcut">' + key + '</kbd>';
});
s += '</div>';
}

return s;
Expand Down

0 comments on commit a579e35

Please sign in to comment.