Auto-focus click-to-edit fields instead of requiring a second click
Type/Client/Facture/Libellé all swap a span for an <input>/<select> via v-if -- Vue doesn't focus a newly created element on its own, so the first click only revealed the field and a second click was needed to actually type into it. Added a v-focus directive (mounted() calls el.focus() + el.select(), firing exactly once per v-if true-flip) to all four. Verified live: a single click on each of the four editable cells now moves document.activeElement into the field immediately.
This commit is contained in:
@@ -147,6 +147,7 @@
|
||||
<td>
|
||||
<input
|
||||
v-if="isEditingCell(item, 'client')"
|
||||
v-focus
|
||||
type="text"
|
||||
class="figli-inline-input"
|
||||
list="figli-client-datalist"
|
||||
@@ -160,6 +161,7 @@
|
||||
<td>
|
||||
<select
|
||||
v-if="editingTypeId === item.id"
|
||||
v-focus
|
||||
class="figli-type-select"
|
||||
:value="item.type"
|
||||
@change="saveType(item, $event)"
|
||||
@@ -178,6 +180,7 @@
|
||||
<td>
|
||||
<input
|
||||
v-if="isEditingCell(item, 'facture')"
|
||||
v-focus
|
||||
type="text"
|
||||
class="figli-inline-input"
|
||||
:value="item.facture"
|
||||
@@ -190,6 +193,7 @@
|
||||
<td class="figli-libelle">
|
||||
<input
|
||||
v-if="isEditingCell(item, 'libelle')"
|
||||
v-focus
|
||||
type="text"
|
||||
class="figli-inline-input"
|
||||
:value="item.libelle"
|
||||
|
||||
Reference in New Issue
Block a user