Merge pull request #11148 from demarches-simplifiees/a11y-combobox-autosave
ETQ usager, je veux que le message d'échec de l'enregistrement soit suffisamment visible
This commit is contained in:
commit
931e8d71d7
6 changed files with 39 additions and 70 deletions
|
@ -1,18 +1,5 @@
|
||||||
@import 'colors';
|
|
||||||
@import 'constants';
|
|
||||||
|
|
||||||
.autosave {
|
.autosave {
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.autosave-explanation {
|
|
||||||
margin-left: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.autosave-explanation-text,
|
|
||||||
.autosave-label {
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.autosave-status {
|
.autosave-status {
|
||||||
|
@ -20,21 +7,15 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
&.succeeded .autosave-label {
|
&.succeeded {
|
||||||
color: $green;
|
color: var(--success-425-625);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failed .autosave-label {
|
&.failed {
|
||||||
color: $orange;
|
color: var(--warning-425-625);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.autosave-icon {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: -1px;
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.autosave-retry {
|
.autosave-retry {
|
||||||
&:disabled {
|
&:disabled {
|
||||||
.autosave-retry-label {
|
.autosave-retry-label {
|
||||||
|
@ -91,17 +72,6 @@ $autosave-status-fade-out-duration: 0.7s;
|
||||||
transition-property: opacity;
|
transition-property: opacity;
|
||||||
transition-duration: $autosave-status-fade-in-duration;
|
transition-duration: $autosave-status-fade-in-duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the icon pulse (if any)
|
|
||||||
.autosave-icon {
|
|
||||||
opacity: 1;
|
|
||||||
// Make the icon pulse after being made visible
|
|
||||||
animation-name: pulse;
|
|
||||||
animation-duration: 0.25s;
|
|
||||||
animation-delay: 0.15s;
|
|
||||||
animation-timing-function: linear;
|
|
||||||
animation-fill-mode: backwards;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show only the relevant status message (succeeded of failed)
|
// Show only the relevant status message (succeeded of failed)
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
en:
|
en:
|
||||||
brouillon:
|
brouillon:
|
||||||
explanation: Your draft is automatically saved.
|
explanation: Your draft is automatically saved.
|
||||||
confirmation: Draft saved
|
confirmation_html: Draft successfully saved.
|
||||||
error: Impossible to save the draft
|
error_html: '<span class="sr-only">Warning:</span> Impossible to save the draft.'
|
||||||
en_construction:
|
en_construction:
|
||||||
explanation: Your modifications are automatically saved.
|
explanation: Your modifications are automatically saved.
|
||||||
submit_them: Submit them when you’re done.
|
submit_them: Submit them when you’re done.
|
||||||
confirmation: Modifications saved
|
confirmation_html: Modifications successfully saved.
|
||||||
error: Impossible to save the modifications.
|
error_html: '<span class="sr-only">Warning:</span> Impossible to save the modifications.'
|
||||||
annotations:
|
annotations:
|
||||||
explanation: Your annotations are automatically saved.
|
explanation: Your annotations are automatically saved.
|
||||||
confirmation: Annotations saved
|
confirmation_html: Annotations successfully saved.
|
||||||
error: Impossible to save the annotations
|
error_html: '<span class="sr-only">Warning:</span> Impossible to save the annotations.'
|
||||||
more_information: More informations
|
more_information: More informations
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
fr:
|
fr:
|
||||||
brouillon:
|
brouillon:
|
||||||
explanation: Votre brouillon est automatiquement enregistré.
|
explanation: Votre brouillon est automatiquement enregistré.
|
||||||
confirmation: Brouillon enregistré
|
confirmation_html: 'Brouillon enregistré <span class="sr-only">avec succès</span>'
|
||||||
error: Impossible d’enregistrer le brouillon
|
error_html: '<span class="sr-only">Attention :</span> Impossible d’enregistrer le brouillon.'
|
||||||
en_construction:
|
en_construction:
|
||||||
explanation: Vos modifications sont automatiquement enregistrées.
|
explanation: Vos modifications sont automatiquement enregistrées.
|
||||||
submit_them: Déposez-les quand vous aurez terminé.
|
submit_them: Déposez-les quand vous aurez terminé.
|
||||||
confirmation: Modifications enregistrées.
|
confirmation_html: 'Modifications enregistrées <span class="sr-only">avec succès</span>'
|
||||||
error: Impossible d’enregistrer les modifications
|
error_html: '<span class="sr-only">Attention :</span> Impossible d’enregistrer les modifications.'
|
||||||
annotations:
|
annotations:
|
||||||
explanation: Vos annotations sont automatiquement enregistrées.
|
explanation: Vos annotations sont automatiquement enregistrées.
|
||||||
confirmation: Annotations enregistrées
|
confirmation_html: 'Annotations enregistrées <span class="sr-only">avec succès</span>'
|
||||||
error: Impossible d’enregistrer les annotations
|
error_html: '<span class="sr-only">Attention :</span> Impossible d’enregistrer les annotations.'
|
||||||
more_information: En savoir plus
|
more_information: En savoir plus
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.autosave.autosave-state-idle{ data: { controller: 'autosave-status' } }
|
.autosave.autosave-state-failed{ data: { controller: 'autosave-status' } }
|
||||||
%p.autosave-explanation.fr-text--sm.fr-mb-0
|
%p.autosave-explanation.fr-text--sm.fr-mb-0
|
||||||
%span.autosave-explanation-text
|
%span.autosave-explanation-text
|
||||||
- if annotation?
|
- if annotation?
|
||||||
|
@ -10,29 +10,27 @@
|
||||||
- else
|
- else
|
||||||
= t('.brouillon.explanation')
|
= t('.brouillon.explanation')
|
||||||
- if !annotation?
|
- if !annotation?
|
||||||
= link_to t('.more_information'), t("links.common.faq.autosave_url"), class: 'fr-link fr-link--sm', **external_link_attributes
|
= link_to t('.more_information'), t("links.common.faq.autosave_url"), class: 'fr-link fr-link--sm fr-ml-1w', **external_link_attributes
|
||||||
|
|
||||||
%p.autosave-status.succeeded.fr-mb-0
|
%p.autosave-status.succeeded.fr-text--sm.fr-mb-0
|
||||||
= dsfr_icon('fr-icon-checkbox-circle-fill fr-text-default--success autosave-icon')
|
%span.fr-icon-success-fill.fr-mr-1v{ 'aria-hidden': 'true' }
|
||||||
%span.autosave-label
|
|
||||||
- if annotation?
|
- if annotation?
|
||||||
= t('.annotations.confirmation')
|
= t('.annotations.confirmation_html')
|
||||||
- elsif dossier.editing_fork?
|
- elsif dossier.editing_fork?
|
||||||
= t('.en_construction.confirmation')
|
= t('.en_construction.confirmation_html')
|
||||||
- else
|
- else
|
||||||
= t('.brouillon.confirmation')
|
= t('.brouillon.confirmation_html')
|
||||||
- if !annotation?
|
- if !annotation?
|
||||||
= link_to t('.more_information'), t("links.common.faq.autosave_url"), class: 'fr-link fr-link--sm', **external_link_attributes
|
= link_to t('.more_information'), t("links.common.faq.autosave_url"), class: 'fr-link fr-link--sm fr-ml-1w', **external_link_attributes
|
||||||
|
|
||||||
%p.autosave-status.failed.fr-mb-0
|
%p.autosave-status.failed.fr-text--sm.fr-mb-0
|
||||||
%span.autosave-icon ⚠️
|
%span.fr-icon-warning-fill.fr-mr-1v{ 'aria-hidden': 'true' }
|
||||||
%span.autosave-label
|
|
||||||
- if annotation?
|
- if annotation?
|
||||||
= t('.annotations.error')
|
= t('.annotations.error_html')
|
||||||
- elsif dossier.editing_fork?
|
- elsif dossier.editing_fork?
|
||||||
= t('.en_construction.error')
|
= t('.en_construction.error_html')
|
||||||
- else
|
- else
|
||||||
= t('.brouillon.error')
|
= t('.brouillon.error_html')
|
||||||
%button.fr-btn.fr-btn--tertiary.fr-btn--sm.autosave-retry{ type: :button, data: { action: 'autosave-status#onClickRetryButton', autosave_status_target: 'retryButton' } }
|
%button.fr-btn.fr-btn--tertiary.fr-btn--sm.fr-ml-1w.fr-mt-n1v.autosave-retry{ type: :button, data: { action: 'autosave-status#onClickRetryButton', autosave_status_target: 'retryButton' } }
|
||||||
%span.autosave-retry-label Réessayer
|
%span.autosave-retry-label Réessayer
|
||||||
%span.autosave-retrying-label Enregistrement en cours…
|
%span.autosave-retrying-label Enregistrement en cours…
|
||||||
|
|
|
@ -59,6 +59,8 @@ export function ComboBox({
|
||||||
<div className="fr-ds-combobox__input" style={{ position: 'relative' }}>
|
<div className="fr-ds-combobox__input" style={{ position: 'relative' }}>
|
||||||
<Input className="fr-select fr-autocomplete" ref={inputRef} />
|
<Input className="fr-select fr-autocomplete" ref={inputRef} />
|
||||||
<Button
|
<Button
|
||||||
|
aria-haspopup="false"
|
||||||
|
aria-label=""
|
||||||
style={{
|
style={{
|
||||||
width: '40px',
|
width: '40px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
|
|
|
@ -614,8 +614,7 @@ describe 'The user', js: true do
|
||||||
allow_any_instance_of(Users::DossiersController).to receive(:update).and_raise("Server is busy")
|
allow_any_instance_of(Users::DossiersController).to receive(:update).and_raise("Server is busy")
|
||||||
fill_in('texte obligatoire', with: 'a valid user input')
|
fill_in('texte obligatoire', with: 'a valid user input')
|
||||||
blur
|
blur
|
||||||
expect(page).to have_css('span', text: 'Impossible d’enregistrer le brouillon', visible: true)
|
expect(page).to have_text('Attention : Impossible d’enregistrer le brouillon.')
|
||||||
|
|
||||||
# Test that retrying after a failure works
|
# Test that retrying after a failure works
|
||||||
allow_any_instance_of(Users::DossiersController).to receive(:update).and_call_original
|
allow_any_instance_of(Users::DossiersController).to receive(:update).and_call_original
|
||||||
click_on 'Réessayer'
|
click_on 'Réessayer'
|
||||||
|
|
Loading…
Add table
Reference in a new issue