Skip to content

Commit 3af017b

Browse files
committed
Improve tooltips
Only show tooltip if help text; move key to title attribute; fix overflow
1 parent 3de21ac commit 3af017b

2 files changed

Lines changed: 7 additions & 20 deletions

File tree

frontend/src/modules/scaffold/less/forms.less

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ form .error {
5353
}
5454

5555
.field {
56+
position: relative;
5657
padding: 10px 30px;
5758
&-object {
5859
padding: 8px 10px;
@@ -84,32 +85,21 @@ form .error {
8485
}
8586

8687
.field-help {
87-
position: relative;
8888
display: inline-block;
8989
padding: 0 3px;
9090
.tooltip {
9191
position: absolute;
9292
z-index: 2;
93-
top: 0;
94-
left: 105%;
93+
max-width: 300px;
9594
padding: 5px;
9695
border-radius: 6px;
96+
margin: 10px 0;
9797
background-color: @tertiary-color;
9898
color: @white;
9999
opacity: 0;
100100
text-align: center;
101101
transition: opacity 0.3s, visibility 0s 0.3s;
102102
visibility: hidden;
103-
.tooltip-key {
104-
color: @primary-color;
105-
font-family: monospace;
106-
}
107-
.tooltip-help {
108-
width: 300px;
109-
.scaffold-items-modal & {
110-
width: 200px;
111-
}
112-
}
113103
}
114104
i:hover + .tooltip {
115105
opacity: 0.9;

frontend/src/modules/scaffold/templates/field.hbs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<div class="field{{#if title}} field-{{stringToClassName title}}{{else}}{{#if legend}} field-object field-object-{{stringToClassName legend}}{{/if}}{{/if}}{{#if isDefaultValue}} is-default-value{{/if}}" data-editor-id="{{editorId}}" data-type="{{#if inputType.type}}{{inputType.type}}{{else}}{{inputType}}{{/if}}">
22
{{#if title}}
3-
<label for="{{editorId}}">{{title}}</label>
3+
<label for="{{editorId}}" title="{{key}}">{{title}}</label>
4+
{{#if help}}
45
<div class="field-help">
56
<i class="fa fa-info-circle"></i>
6-
<div class="tooltip">
7-
<div class="tooltip-key">{{key}}</div>
8-
{{#if help}}
9-
<div class="tooltip-help">{{help}}</div>
10-
{{/if}}
11-
</div>
7+
<div class="tooltip">{{help}}</div>
128
</div>
9+
{{/if}}
1310
<button class="field-default" data-action="default" title="{{t 'app.reset'}}">
1411
<i class="fa fa-undo"></i>
1512
</button>

0 commit comments

Comments
 (0)