Skip to content

Commit 4390430

Browse files
committed
adding aria-labels, tooltips and disable buttons when no layer and field is selected
1 parent 3591d9d commit 4390430

4 files changed

Lines changed: 43 additions & 23 deletions

File tree

src/main/js/bundles/dn_labeling/LabelingWidget.vue

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
</v-sheet>
5858
<v-sheet class="my-1">
5959
<h3>{{ i18n.selectionFields }}</h3>
60+
<!--TODO: Element not focusable with keyboard, even when not disabled-->
6061
<v-select
6162
id="autocomplete"
6263
v-model="selectedFields"
@@ -92,18 +93,38 @@
9293

9394
<span>{{ data.item.name }}</span>
9495
<span>
95-
<v-btn
96-
icon
97-
@click="setEdit(data.item)"
96+
<v-tooltip
97+
top
98+
open-delay="800"
9899
>
99-
<v-icon small>edit</v-icon>
100-
</v-btn>
101-
<v-btn
102-
icon
103-
@click="remove(data.item)"
100+
<template #activator="{ on }">
101+
<v-btn
102+
icon
103+
:aria-label="i18n.editAttributeLabel"
104+
v-on="on"
105+
@click="setEdit(data.item)"
106+
>
107+
<v-icon small>edit</v-icon>
108+
</v-btn>
109+
</template>
110+
<span>{{ i18n.editAttributeLabel }}</span>
111+
</v-tooltip>
112+
<v-tooltip
113+
top
114+
open-delay="800"
104115
>
105-
<v-icon small>close</v-icon>
106-
</v-btn>
116+
<template #activator="{ on }">
117+
<v-btn
118+
icon
119+
:aria-label="i18n.deleteAttributeLabel"
120+
v-on="on"
121+
@click="remove(data.item)"
122+
>
123+
<v-icon small>close</v-icon>
124+
</v-btn>
125+
</template>
126+
<span>{{ i18n.deleteAttributeLabel }}</span>
127+
</v-tooltip>
107128
</span>
108129
</v-chip>
109130
</draggable>
@@ -124,23 +145,18 @@
124145
</div>
125146
<div>
126147
<v-btn
127-
v-if="!active"
128148
color="primary"
149+
:aria-pressed="active"
150+
:disabled="selectedFields.length === 0"
129151
@click.native="setLabeling"
130152
>
131-
<v-icon>icon-play</v-icon>
132-
{{ i18n.labeling.start }}
153+
<v-icon>{{ !active ? "icon-play" : "icon-pause" }}</v-icon>
154+
{{ !active ? i18n.labeling.start : i18n.labeling.stop }}
133155
</v-btn>
134156
<v-btn
135-
v-else
136-
color="primary"
137-
@click.native="setLabeling"
138-
>
139-
<v-icon>icon-pause</v-icon>
140-
{{ i18n.labeling.stop }}
141-
</v-btn>
142-
<v-btn
143-
color="secondary"
157+
color="error"
158+
outline
159+
:disabled="!selectedLayer || (selectedLayer && selectedFields.length === 0)"
144160
@click.native="deleteLabel"
145161
>
146162
<v-icon>icon-trashcan-detailed</v-icon>

src/main/js/bundles/dn_labeling/css/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
.v-chip__content{
3535
width: 100%;
3636
padding: 0;
37-
cursor: pointer;
37+
cursor: move;
3838
}
3939
}
4040
}

src/main/js/bundles/dn_labeling/nls/bundle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const i18n = {
3838
tooltip: "Labeling Tool",
3939
selectionTitle: "Select Layer",
4040
selectionFields: "Select Fields",
41+
editAttributeLabel: "Edit attribute label",
42+
deleteAttributeLabel: "Delete attribute label",
4143
edgesLabel: "Label Edge Lengths",
4244
autoUpdate: "Keep updated",
4345
prefix: "Prefix",

src/main/js/bundles/dn_labeling/nls/de/bundle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default {
4040
tooltip: "Beschriftungswerkzeug",
4141
selectionTitle: "Layer auswählen",
4242
selectionFields: "Felder auswählen",
43+
editAttributeLabel: "Attributbeschriftung bearbeiten",
44+
deleteAttributeLabel: "Attributebeschriftung entfernen",
4345
edgesLabel: "Kantenlängen beschriften",
4446
autoUpdate: "Änderungen automatisch anwenden",
4547
prefix: "Präfix",

0 commit comments

Comments
 (0)