Skip to content

Commit 84c8cb4

Browse files
committed
minor fixes
1 parent 004850b commit 84c8cb4

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

‎client/src/components/Tracks/bottombar/BottomBarTrackItemView.vue‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ export default defineComponent({
5252
const notesInputRef = ref<HTMLInputElement | null>(null);
5353
const editingAttributeKey = ref<string | null>(null);
5454
const editAttributeValue = ref('');
55-
// Rendered inside a v-for, where Vue collects the refs into an array
56-
const attributeInputRef = ref<HTMLInputElement | HTMLInputElement[] | null>(null);
55+
const attributeInputRef = ref<HTMLInputElement | null>(null);
5756
const localAttributeDisplay = ref<Record<string, string>>({});
5857
58+
function setAttributeInputRef(el: HTMLInputElement | null) {
59+
attributeInputRef.value = el;
60+
}
61+
5962
watch(() => props.track.id, () => {
6063
localNotesDisplay.value = '';
6164
localAttributeDisplay.value = {};
@@ -213,9 +216,8 @@ export default defineComponent({
213216
editingAttributeKey.value = attrKey;
214217
nextTick(() => {
215218
// Without focus the field would never blur, and so never close
216-
const input = [attributeInputRef.value].flat()[0];
217-
input?.focus();
218-
input?.select();
219+
attributeInputRef.value?.focus();
220+
attributeInputRef.value?.select();
219221
});
220222
}
221223
@@ -263,7 +265,7 @@ export default defineComponent({
263265
264266
return {
265267
allTypes,
266-
attributeInputRef,
268+
setAttributeInputRef,
267269
cancelEditAttribute,
268270
cancelEditConfidence,
269271
cancelEditNotes,
@@ -448,7 +450,7 @@ export default defineComponent({
448450
<input
449451
v-if="editingAttributeKey === attrKey"
450452
:key="attrKey + '-input'"
451-
ref="attributeInputRef"
453+
:ref="setAttributeInputRef"
452454
:value="editAttributeValue"
453455
type="text"
454456
class="compact-attribute-input"
@@ -640,6 +642,13 @@ export default defineComponent({
640642
padding: 1px 4px;
641643
margin-right: 8px;
642644
outline: none;
645+
646+
&.track-length {
647+
width: 64px;
648+
min-width: 64px;
649+
max-width: 64px;
650+
text-align: center;
651+
}
643652
}
644653
645654
.track-length {

0 commit comments

Comments
 (0)