Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composant avec plusieurs contrôles : seul le premier message est affiché #211

Closed
nsenave opened this issue Dec 3, 2024 · 3 comments
Closed
Assignees
Labels
Type: Bug Something isn't working

Comments

@nsenave
Copy link

nsenave commented Dec 3, 2024

Describe the bug

When on a component we trigger more than one controls, only the first control is displayed.
It is not the case in Lunatic

  • ☑️ I tested it on the storybook, which leads me to believe that it's a lunatic bug.

To Reproduce

Examples:

{
	"id": "questionnaire-id",
	"pagination": "question",
	"maxPage": "2",
	"label": {
		"type": "VTL|MD",
		"value": "Questionnaire label"
	},
	"components": [
		{
			"id": "name-id",
			"page": "1",
			"componentType": "Input",
			"maxLength": 30,
			"label": {
				"value": "\"What's your name?\"",
				"type": "VTL|MD"
			},
			"description": {
				"value": "\"No more than 30 characters\"",
				"type": "VTL|MD"
			},
			"controls": [
				{
					"id": "foo-control-id",
					"typeOfControl": "CONSISTENCY",
					"criticality": "WARN",
					"errorMessage": {
						"type": "VTL|MD",
						"value": "\"FOO control.\""
					},
					"control": {
						"type": "VTL",
						"value": "false"
					}
				},
				{
					"id": "bar-control-id",
					"typeOfControl": "CONSISTENCY",
					"criticality": "WARN",
					"errorMessage": {
						"type": "VTL|MD",
						"value": "\"BAR control\""
					},
					"control": {
						"type": "VTL",
						"value": "false"
					}
				}
			],
			"response": {
				"name": "NAME"
			}
		},
		{
			"id": "sequence-id",
			"page": "2",
			"componentType": "Sequence",
			"label": {
				"value": "\"Bye!\"",
				"type": "VTL|MD"
			}
		}
	],
	"variables": [
		{
			"variableType": "COLLECTED",
			"name": "NAME"
		}
	]
}

Expected behavior

In this example, the messages FOO control. and BAR control. should be displayed

Screenshots

screenshot-lunatic-dsfr

screenshot-lunatic

Version where the bug appeared

i think it has always been

Browser where the bug was tested

  • Firefox

Additional context

  • I tested if with several levels INFO/WARN/ERROR and types CONSISTENCY/FORMAT which didn't seem to change anything in regard to this issue.
  • I tested it in the "DSFR" storybook.

Open question: What should happen if both controls are triggered?

@nsenave nsenave added the Type: Bug Something isn't working label Dec 3, 2024
@QRuhier QRuhier transferred this issue from InseeFr/Lunatic Dec 3, 2024
@QRuhier
Copy link
Contributor

QRuhier commented Dec 3, 2024

Lunatic is handling the entire list of errors, but in Lunatic-DSFR we only keep the first error from the list.
see https://github.com/InseeFr/Lunatic-DSFR/blob/main/src/utils/errorStates.ts

@AnneHuSKa Would you have an idea if it was a deliberate choice ? (DSFR constraint ?)

I think there is here the idea of handling the display considering the criticity of the control : if we have multiple controls with a different criticity we could not really display them all with a common display => what to do in that case ?

Lunatic does not handle criticity at all, it simply displays all the errors => should we also wonder about that ?

@AnneHuSKa
Copy link

@nsenave @QRuhier : C'est bien un choix de conception (je ne sais pas si c'est une contrainte DSFR mais ca a été un choix méthodologique) : on résoud un controle puis l'autre, en commencant par le format idéalement.
https://inseefr.github.io/stromae-dsfr/docs/application/controls#laffichage
Il va y avoir un toilettage probable des controles en 2025 (les rendre plus "accessibles", les mettre dans Queen) : peut-être question à rechallenger à ce moment là ?
Mais en web aujourd'hui c'est un choix.

@QRuhier
Copy link
Contributor

QRuhier commented Dec 4, 2024

Donc pas de problème sur le fonctionnel actuel dans Lunatic-dsfr.
A voir plus tard côté Lunatic si l'on souhaite se rapprocher de celui-ci ou améliorer le paramétrage des contrôles

@QRuhier QRuhier closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants