When a choice item with itemControl=autocomplete is clicked for the first time, the MUI dropdown opens immediately and displays "No options" — because results are fetched from the terminology server on input, so the options array is empty on initial focus.
This is misleading: options do appear once the user starts typing. The open-choice equivalent avoids this because it uses MUI's freeSolo prop, which suppresses the popup when no options are loaded.
To reproduce: paste the following into the Playground:
{
"resourceType": "Questionnaire",
"status": "active",
"item": [
{
"linkId": "gender",
"text": "Gender (choice autocomplete)",
"type": "choice",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "autocomplete"
}
]
}
}
],
"answerValueSet": "http://hl7.org/fhir/ValueSet/administrative-gender"
},
{
"linkId": "gender-open",
"text": "Gender (open-choice autocomplete)",
"type": "open-choice",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "autocomplete"
}
]
}
}
],
"answerValueSet": "http://hl7.org/fhir/ValueSet/administrative-gender"
}
]
}
Click into the choice field without typing — it shows "No options". Click into the open-choice field — no dropdown appears. The latter is less confusing.
Expected behaviour: Either show nothing on initial focus, or show a prompt like "Type to search..." instead of "No options".
Suggested fix: Set noOptionsText="Type to search..." on ChoiceAutocompleteField (or conditionally, only when the input is empty).
Affected component: ChoiceAutocompleteField.tsx
When a
choiceitem withitemControl=autocompleteis clicked for the first time, the MUI dropdown opens immediately and displays "No options" — because results are fetched from the terminology server on input, so the options array is empty on initial focus.This is misleading: options do appear once the user starts typing. The
open-choiceequivalent avoids this because it uses MUI'sfreeSoloprop, which suppresses the popup when no options are loaded.To reproduce: paste the following into the Playground:
{ "resourceType": "Questionnaire", "status": "active", "item": [ { "linkId": "gender", "text": "Gender (choice autocomplete)", "type": "choice", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/questionnaire-item-control", "code": "autocomplete" } ] } } ], "answerValueSet": "http://hl7.org/fhir/ValueSet/administrative-gender" }, { "linkId": "gender-open", "text": "Gender (open-choice autocomplete)", "type": "open-choice", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/questionnaire-item-control", "code": "autocomplete" } ] } } ], "answerValueSet": "http://hl7.org/fhir/ValueSet/administrative-gender" } ] }Click into the
choicefield without typing — it shows "No options". Click into theopen-choicefield — no dropdown appears. The latter is less confusing.Expected behaviour: Either show nothing on initial focus, or show a prompt like "Type to search..." instead of "No options".
Suggested fix: Set
noOptionsText="Type to search..."onChoiceAutocompleteField(or conditionally, only when the input is empty).Affected component: ChoiceAutocompleteField.tsx