style(spinner): fix positioning for conditional champs

This commit is contained in:
Colin Darie 2023-09-05 18:31:30 +02:00
parent 5aa4a117c8
commit d56e3908ac
3 changed files with 5 additions and 5 deletions

View file

@ -514,7 +514,7 @@
}
}
fieldset ~ .spinner {
fieldset + .spinner {
position: relative;
top: -($default-fields-spacer / 2);
}

View file

@ -124,12 +124,12 @@ export class AutosaveController extends ApplicationController {
private showSpinner(champElement: Element) {
this.#spinnerTimeoutId = setTimeout(() => {
// do not do anything if there is already a spinner for this champ, like SIRET champ
if (!champElement.querySelector('.spinner')) {
if (!champElement.nextElementSibling?.classList.contains('spinner')) {
const spinner = document.createElement('div');
spinner.classList.add('spinner', 'spinner-removable');
spinner.setAttribute('aria-live', 'live');
spinner.setAttribute('aria-label', 'Chargement en cours…');
champElement.appendChild(spinner);
champElement.insertAdjacentElement('afterend', spinner);
}
}, AUTOSAVE_CONDITIONAL_SPINNER_DEBOUNCE_DELAY);
}

View file

@ -11,8 +11,8 @@
= turbo_stream.update champ.labelledby_id do
= render EditableChamp::ChampLabelContentComponent.new champ:, form:
= turbo_stream.remove_all(".editable-champ .spinner-removable")
= turbo_stream.hide_all(".editable-champ .spinner")
= turbo_stream.remove_all(".editable-champ + .spinner-removable")
= turbo_stream.hide_all(".editable-champ + .spinner")
- if dossier.present?
= turbo_stream.replace_all '.dossier-edit-sticky-footer' do