Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Fix queue #8 — edit participants autocomplete dropdown no longer lands in the top-left of the viewport — getParticipantDropdownPosition was looking up the input via document.querySelectorAll('.max-w-md input[placeholder=...']) where neither the .max-w-md class nor the i18n placeholder string match the design-system modal's markup (input uses .field and a literal English placeholder), so the lookup matched no element and the function fell back to top: 0, left: 0; now the input carries a :data-participant-index attribute and the JS looks it up via input[data-participant-index=N], which is independent of class names and placeholder text

Murtaza Nasir9ee769ea77b7
diff --git a/static/js/modules/composables/ui.js b/static/js/modules/composables/ui.js
index 8d2c3f34..9a821d8c 100644
--- a/static/js/modules/composables/ui.js
+++ b/static/js/modules/composables/ui.js
@@ -1965,10 +1965,16 @@ export function useUI(state, utils, processedTranscription) {
};
const getParticipantDropdownPosition = (index) => {
- // Find the input element for this index and calculate position
- const inputs = document.querySelectorAll('.max-w-md input[placeholder="' + t('form.participantNamePlaceholder') + '"]');
- if (inputs[index]) {
- const rect = inputs[index].getBoundingClientRect();
+ // Look up the input by its data attribute (set in the modal
+ // template) rather than a fragile class+placeholder selector.
+ // The old selector targeted .max-w-md input[placeholder="…"]
+ // but the new design-system modal uses .field on the input and
+ // a literal English placeholder; the lookup matched no
+ // element and the fallback below dropped the dropdown into
+ // the top-left corner of the viewport.
+ const input = document.querySelector(`input[data-participant-index="${index}"]`);
+ if (input) {
+ const rect = input.getBoundingClientRect();
return {
top: rect.bottom + 2 + 'px',
left: rect.left + 'px',
diff --git a/templates/modals/edit-participants-modal.html b/templates/modals/edit-participants-modal.html
index b0bf8076..cf393cc4 100644
--- a/templates/modals/edit-participants-modal.html
+++ b/templates/modals/edit-participants-modal.html
@@ -15,6 +15,7 @@
@input="filterParticipantSuggestions(index)"
@focus="filterParticipantSuggestions(index)"
@blur="closeParticipantSuggestionsDelayed(index)"
+ :data-participant-index="index"
type="text" class="field" placeholder="Participant name...">
</div>
<teleport to="body">