Skip to content

Commit fb08a1b

Browse files
joshuazeltserNorah Abanumay
andauthored
TO show tooltips via keyboard forDuplicate,View,Rename, Download, Shutdown, Edit,Move, Delete buttons. (#4729)
Co-authored-by: Norah Abanumay <[email protected]>
1 parent a90121c commit fb08a1b

File tree

2 files changed

+69
-9
lines changed

2 files changed

+69
-9
lines changed

notebook/static/tree/less/tree.less

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ ul.breadcrumb {
6767
.dynamic-buttons {
6868
padding-top: @dashboard_tb_pad - 1px;
6969
display: inline-block;
70+
width: 400px;
71+
7072
}
7173

7274
.list_toolbar [class*="span"] {
@@ -410,3 +412,48 @@ ul#new-menu {
410412
display: inline-block;
411413
padding-top: @dashboard_tb_pad;
412414
}
415+
416+
//TO show tooltips via keyboard for"Duplicate","View","Rename", "Download", "Shutdown", "Edit","Move", "Delete" buttons.
417+
418+
.visually-hidden {
419+
clip-path: inset(100%);
420+
clip: rect(1px, 1px, 1px, 1px);
421+
height: 1px;
422+
overflow: hidden;
423+
position: absolute;
424+
white-space: nowrap;
425+
width: 1px;
426+
}
427+
428+
button:focus + [role="tooltip"] {
429+
visibility: visible;
430+
opacity: 1;
431+
}
432+
433+
.button-and-tooltip {
434+
position: relative;
435+
display: inline-block;
436+
}
437+
438+
[role="tooltip"] {
439+
/* Position the tooltip */
440+
position: absolute;
441+
top:70%;
442+
display:inline;
443+
//--------------
444+
visibility: hidden;
445+
width: 100px;
446+
background-color: #F0EFEF;
447+
color: #080808;
448+
text-align: center;
449+
padding: 3px;
450+
outline-color: grey;
451+
outline-offset: -2px;
452+
outline-style: auto;
453+
outline-width:1px;
454+
z-index: 1;
455+
opacity: 0;
456+
transition: opacity .6s;
457+
margin: 3px;
458+
font-size:10px;
459+
}

notebook/templates/tree.html

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,24 @@
4141
{% trans %}Select items to perform actions on them.{% endtrans %}
4242
</div>
4343
<div class="dynamic-buttons">
44-
<button title="{% trans %}Duplicate selected{% endtrans %}" aria-label="{% trans %}Duplicate{% endtrans %}" class="duplicate-button btn btn-default btn-xs">{% trans %}Duplicate{% endtrans %}</button>
45-
<button title="{% trans %}Rename selected{% endtrans %}" aria-label="{% trans %}Rename{% endtrans %}" class="rename-button btn btn-default btn-xs">{% trans %}Rename{% endtrans %}</button>
46-
<button title="{% trans %}Move selected{% endtrans %}" aria-label="{% trans %}Move{% endtrans %}" class="move-button btn btn-default btn-xs">{% trans %}Move{% endtrans %}</button>
47-
<button title="{% trans %}Download selected{% endtrans %}" aria-label="{% trans %}Download{% endtrans %}" class="download-button btn btn-default btn-xs">{% trans %}Download{% endtrans %}</button>
48-
<button title="{% trans %}Shutdown selected notebook(s){% endtrans %}" aria-label="{% trans %}Shutdown{% endtrans %}" class="shutdown-button btn btn-default btn-xs btn-warning">{% trans %}Shutdown{% endtrans %}</button>
49-
<button title="{% trans %}View selected{% endtrans %}" aria-label="{% trans %}View{% endtrans %}" class="view-button btn btn-default btn-xs">{% trans %}View{% endtrans %}</button>
50-
<button title="{% trans %}Edit selected{% endtrans %}" aria-label="{% trans %}Edit{% endtrans %}" class="edit-button btn btn-default btn-xs">{% trans %}Edit{% endtrans %}</button>
51-
<button title="{% trans %}Delete selected{% endtrans %}" aria-label="{% trans %}Delete selected{% endtrans %}" class="delete-button btn btn-default btn-xs btn-danger"><i class="fa fa-trash"></i></button>
44+
<button title="{% trans %}Duplicate selected{% endtrans %}" aria-label="{% trans %}Duplicate selected{% endtrans %}" class="duplicate-button btn btn-default btn-xs" aria-describedby="tooltip1">{% trans %}Duplicate{% endtrans %} </button>
45+
<div role="tooltip" id="tooltip1" >{% trans %}Duplicate selected{% endtrans %}</div>
46+
<button title="{% trans %}Rename selected{% endtrans %}" aria-label="{% trans %}Rename selected{% endtrans %}" class="rename-button btn btn-default btn-xs" aria-describedby="tooltip2">{% trans %}Rename{% endtrans %}</button>
47+
<div role="tooltip" id="tooltip2" >{% trans %}Rename selected{% endtrans %}</div>
48+
<button title="{% trans %}Move selected{% endtrans %}" aria-label="{% trans %}Move selected{% endtrans %}" class="move-button btn btn-default btn-xs" aria-describedby="tooltip3">{% trans %}Move{% endtrans %}</button>
49+
<div role="tooltip" id="tooltip3" >{% trans %}Move selected{% endtrans %}</div>
50+
<button title="{% trans %}Download selected{% endtrans %}" aria-label="{% trans %}Download selected{% endtrans %}" class="download-button btn btn-default btn-xs" aria-describedby="tooltip4">{% trans %}Download{% endtrans %}</button>
51+
<div role="tooltip" id="tooltip4" >{% trans %}Download selected{% endtrans %}</div>
52+
<button title="{% trans %}Shutdown selected notebook(s){% endtrans %}" aria-label="{% trans %}Shutdown selected notebook(s){% endtrans %}" class="shutdown-button btn btn-default btn-xs btn-warning" aria-describedby="tooltip5">{% trans %}Shutdown{% endtrans %}</button>
53+
<div role="tooltip" id="tooltip5" >{% trans %}Shutdown selected notebook(s){% endtrans %}</div>
54+
<button title="{% trans %}View selected{% endtrans %}" aria-label="{% trans %}View selected{% endtrans %}" class="view-button btn btn-default btn-xs" aria-describedby="tooltip6">{% trans %}View{% endtrans %}</button>
55+
<div role="tooltip" id="tooltip6" >{% trans %}View selected{% endtrans %}</div>
56+
<button title="{% trans %}Edit selected{% endtrans %}" aria-label="{% trans %}Edit selected{% endtrans %}" class="edit-button btn btn-default btn-xs" aria-describedby="tooltip7">{% trans %}Edit{% endtrans %}</button>
57+
<div role="tooltip" id="tooltip7" >{% trans %}Edit selected{% endtrans %}</div>
58+
<button title="{% trans %}Delete selected{% endtrans %}" aria-label="{% trans %}Delete selected{% endtrans %}" class="delete-button btn btn-default btn-xs btn-danger" aria-describedby="tooltip8">
59+
<i class="fa fa-trash"></i>
60+
</button>
61+
<div role="tooltip" id="tooltip8" >{% trans %}Delete selected{% endtrans %}</div>
5262
</div>
5363
</div>
5464
<div class="col-sm-4 no-padding tree-buttons">
@@ -205,7 +215,10 @@
205215

206216
{% block script %}
207217
{{super()}}
208-
218+
<script type="text/javascript">
219+
('#element').tooltip('enable')
220+
</script>
209221

210222
<script src="{{ static_url("tree/js/main.min.js") }}" type="text/javascript" charset="utf-8"></script>
223+
211224
{% endblock %}

0 commit comments

Comments
 (0)