Make rename functions accessibly by keyboard navigation

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2022-05-12 13:50:31 +02:00
Родитель 90a2b07e5f
Коммит b3f252ee46
3 изменённых файлов: 51 добавлений и 19 удалений

Просмотреть файл

@ -222,6 +222,7 @@ export default {
padding: $stack-spacing; padding: $stack-spacing;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
scrollbar-gutter: stable;
padding-top: 15px; padding-top: 15px;
margin-top: -10px; margin-top: -10px;
} }

Просмотреть файл

@ -23,15 +23,22 @@
<template> <template>
<div class="stack"> <div class="stack">
<div v-click-outside="stopCardCreation" class="stack__header" :class="{'stack__header--add': showAddCard }"> <div v-click-outside="stopCardCreation"
class="stack__header"
:class="{'stack__header--add': showAddCard }"
tabindex="0"
:aria-label="stack.title">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<h3 v-if="!canManage || isArchived"> <h3 v-if="!canManage || isArchived">
{{ stack.title }} {{ stack.title }}
</h3> </h3>
<h3 v-else-if="!editing" <h3 v-else-if="!editing"
v-tooltip="stack.title" v-tooltip="stack.title"
tabindex="0"
:aria-label="stack.title"
class="stack__title" class="stack__title"
@click="startEditing(stack)"> @click="startEditing(stack)"
@keydown.enter="startEditing(stack)">
{{ stack.title }} {{ stack.title }}
</h3> </h3>
<form v-else @submit.prevent="finishedEdit(stack)"> <form v-else @submit.prevent="finishedEdit(stack)">
@ -325,36 +332,47 @@ export default {
flex-grow: 1; flex-grow: 1;
display: flex; display: flex;
cursor: inherit; cursor: inherit;
margin: 0;
input[type=text] { input[type=text] {
flex-grow: 1; flex-grow: 1;
} }
} }
}
.stack__title { h3.stack__title {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: calc($stack-width - 60px); max-width: calc($stack-width - 60px);
border-radius: 3px;
margin: 6px;
padding: 4px 4px;
&:focus {
outline: 2px solid var(--color-border-dark);
border-radius: 3px;
}
}
form {
margin: 2px 0;
}
} }
.stack__card-add { .stack__card-add {
width: $stack-width;
height: 44px; height: 44px;
flex-shrink: 0; flex-shrink: 0;
z-index: 100; z-index: 100;
display: flex; display: flex;
margin-left: 12px;
margin-right: 12px;
margin-top: 5px; margin-top: 5px;
margin-bottom: 20px; margin-bottom: 20px;
background-color: var(--color-main-background); background-color: var(--color-main-background);
form { form {
display: flex; display: flex;
margin-left: 12px;
margin-right: 12px;
width: 100%; width: 100%;
margin: 0;
box-shadow: 0 0 3px var(--color-box-shadow); box-shadow: 0 0 3px var(--color-box-shadow);
border-radius: var(--border-radius-large); border-radius: var(--border-radius-large);
overflow: hidden; overflow: hidden;

Просмотреть файл

@ -35,14 +35,18 @@
{{ board.title }} » {{ stack.title }} {{ board.title }} » {{ stack.title }}
</div> </div>
<div class="card-upper"> <div class="card-upper">
<h3 v-if="compactMode || isArchived || showArchived || !canEdit || standalone"> <h3 v-if="inlineEditingBlocked">
{{ card.title }} {{ card.title }}
</h3> </h3>
<h3 v-else-if="!editing"> <h3 v-else-if="!editing"
<span @click.stop="startEditing(card)">{{ card.title }}</span> tabindex="0"
class="editable"
:aria-label="t('deck', 'Edit card title')"
@click.stop="startEditing(card)"
@keydown.enter.stop.prevent="startEditing(card)">
{{ card.title }}
</h3> </h3>
<form v-else-if="editing"
<form v-if="editing"
v-click-outside="cancelEdit" v-click-outside="cancelEdit"
class="dragDisabled" class="dragDisabled"
@click.stop @click.stop
@ -135,6 +139,9 @@ export default {
const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId) const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId)
return board ? !board.archived && board.permissions.PERMISSION_EDIT : false return board ? !board.archived && board.permissions.PERMISSION_EDIT : false
}, },
inlineEditingBlocked() {
return this.compactMode || this.isArchived || this.showArchived || !this.canEdit || this.standalone
},
card() { card() {
return this.item ? this.item : this.$store.getters.cardById(this.id) return this.item ? this.item : this.$store.getters.cardById(this.id)
}, },
@ -217,14 +224,20 @@ export default {
} }
h3 { h3 {
margin: 12px $card-padding; margin: 5px $card-padding;
padding: 6px;
flex-grow: 1; flex-grow: 1;
font-size: 100%; font-size: 100%;
overflow: hidden; overflow: hidden;
word-wrap: break-word; word-wrap: break-word;
padding-left: 4px; padding-left: 4px;
span { &.editable {
cursor: text; cursor: text;
&:focus {
outline: 2px solid var(--color-border-dark);
border-radius: 3px;
}
} }
} }
input[type=text] { input[type=text] {