Skip to content

Commit 3ae162b

Browse files
committed
Make rename functions accessibly by keyboard navigation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 2c7708d commit 3ae162b

3 files changed

Lines changed: 51 additions & 19 deletions

File tree

src/components/board/Board.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export default {
222222
padding: $stack-spacing;
223223
overflow-x: hidden;
224224
overflow-y: auto;
225+
scrollbar-gutter: stable;
225226
padding-top: 15px;
226227
margin-top: -10px;
227228
}

src/components/board/Stack.vue

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@
2323

2424
<template>
2525
<div class="stack">
26-
<div v-click-outside="stopCardCreation" class="stack__header" :class="{'stack__header--add': showAddCard }">
26+
<div v-click-outside="stopCardCreation"
27+
class="stack__header"
28+
:class="{'stack__header--add': showAddCard }"
29+
tabindex="0"
30+
:aria-label="stack.title">
2731
<transition name="fade" mode="out-in">
2832
<h3 v-if="!canManage || isArchived">
2933
{{ stack.title }}
3034
</h3>
3135
<h3 v-else-if="!editing"
3236
v-tooltip="stack.title"
37+
tabindex="0"
38+
:aria-label="stack.title"
3339
class="stack__title"
34-
@click="startEditing(stack)">
40+
@click="startEditing(stack)"
41+
@keydown.enter="startEditing(stack)">
3542
{{ stack.title }}
3643
</h3>
3744
<form v-else @submit.prevent="finishedEdit(stack)">
@@ -325,36 +332,47 @@ export default {
325332
flex-grow: 1;
326333
display: flex;
327334
cursor: inherit;
335+
margin: 0;
328336
329337
input[type=text] {
330338
flex-grow: 1;
331339
}
332340
}
333-
}
334341
335-
.stack__title {
336-
white-space: nowrap;
337-
overflow: hidden;
338-
text-overflow: ellipsis;
339-
max-width: calc($stack-width - 60px);
342+
h3.stack__title {
343+
white-space: nowrap;
344+
overflow: hidden;
345+
text-overflow: ellipsis;
346+
max-width: calc($stack-width - 60px);
347+
border-radius: 3px;
348+
margin: 6px;
349+
padding: 4px 4px;
350+
351+
&:focus {
352+
outline: 2px solid var(--color-border-dark);
353+
border-radius: 3px;
354+
}
355+
}
356+
357+
form {
358+
margin: 2px 0;
359+
}
340360
}
341361
342362
.stack__card-add {
343-
width: $stack-width;
344363
height: 44px;
345364
flex-shrink: 0;
346365
z-index: 100;
347366
display: flex;
348-
margin-left: 12px;
349-
margin-right: 12px;
350367
margin-top: 5px;
351368
margin-bottom: 20px;
352369
background-color: var(--color-main-background);
353370
354371
form {
355372
display: flex;
373+
margin-left: 12px;
374+
margin-right: 12px;
356375
width: 100%;
357-
margin: 0;
358376
box-shadow: 0 0 3px var(--color-box-shadow);
359377
border-radius: var(--border-radius-large);
360378
overflow: hidden;

src/components/cards/CardItem.vue

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@
3535
{{ board.title }} » {{ stack.title }}
3636
</div>
3737
<div class="card-upper">
38-
<h3 v-if="compactMode || isArchived || showArchived || !canEdit || standalone">
38+
<h3 v-if="inlineEditingBlocked">
3939
{{ card.title }}
4040
</h3>
41-
<h3 v-else-if="!editing">
42-
<span @click.stop="startEditing(card)">{{ card.title }}</span>
41+
<h3 v-else-if="!editing"
42+
tabindex="0"
43+
class="editable"
44+
:aria-label="t('deck', 'Edit card title')"
45+
@click.stop="startEditing(card)"
46+
@keydown.enter.stop.prevent="startEditing(card)">
47+
{{ card.title }}
4348
</h3>
44-
45-
<form v-if="editing"
49+
<form v-else-if="editing"
4650
v-click-outside="cancelEdit"
4751
class="dragDisabled"
4852
@click.stop
@@ -135,6 +139,9 @@ export default {
135139
const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId)
136140
return board ? !board.archived && board.permissions.PERMISSION_EDIT : false
137141
},
142+
inlineEditingBlocked() {
143+
return this.compactMode || this.isArchived || this.showArchived || !this.canEdit || this.standalone
144+
},
138145
card() {
139146
return this.item ? this.item : this.$store.getters.cardById(this.id)
140147
},
@@ -217,14 +224,20 @@ export default {
217224
218225
}
219226
h3 {
220-
margin: 12px $card-padding;
227+
margin: 5px $card-padding;
228+
padding: 6px;
221229
flex-grow: 1;
222230
font-size: 100%;
223231
overflow: hidden;
224232
word-wrap: break-word;
225233
padding-left: 4px;
226-
span {
234+
&.editable {
227235
cursor: text;
236+
237+
&:focus {
238+
outline: 2px solid var(--color-border-dark);
239+
border-radius: 3px;
240+
}
228241
}
229242
}
230243
input[type=text] {

0 commit comments

Comments
 (0)