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

Issue with ORKTextChoiceOther not behaving as expected #1556

Open
iadereggalternova opened this issue Nov 8, 2023 · 6 comments
Open

Issue with ORKTextChoiceOther not behaving as expected #1556

iadereggalternova opened this issue Nov 8, 2023 · 6 comments

Comments

@iadereggalternova
Copy link

When ORKTextChoiceOther.choice is used for allowing an "Other" text entry in a single-choice question with the exclusive parameter set to true, the expected behavior is not consistently observed. The issues are twofold:

  1. Selecting another option does not close the "Other" text field.
  2. When navigating back to the "Other" option after selecting a different one, the text field unexpectedly closes despite the "Other" option remaining selected.

Steps to reproduce

  1. Create a multiple-choice ORKQuestionStep with various ORKTextChoice options and an ORKTextChoiceOther with exclusive set to true.
  2. Present the step within a task.
  3. Select the "Other" option, enter custom text, and then select a different option.
  4. Observe that the text field associated with the "Other" option does not close.
  5. Proceed to the next question, then navigate back, and select the "Other" option again.
  6. Observe that the text field for the "Other" option closes even though "Other" remains selected.

Expected Behavior

  1. The "Other" text field should close when an exclusive different choice is selected.
  2. Upon returning to the question and re-selecting "Other," the text field should reopen and display previously entered text.

Actual Behavior

  1. The "Other" text field remains visible when a different choice is selected.
  2. When selecting a different option and then returning to the "Other" option, the text field closes, although "Other" remains selected

Code sample

 let textChoices = [
      ORKTextChoice(text: "Option 1", value: 0 as NSNumber),
      ORKTextChoice(text: "Option 2", value: 1 as NSNumber),
      ORKTextChoice(text: "Option 3", value: 2 as NSNumber),
      ORKTextChoiceOther.choice(withText: "Other", detailText: "", value: 3 as NSNumber, exclusive: true, textViewPlaceholderText: "Tap to write your answer")
  ]

  let singleChoiceQuestionStep = ORKQuestionStep(identifier: "singleChoiceQuestionStep", title: "Single choice question", question: "Select an choice:", answer: ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: textChoices))

image

@louie-apple
Copy link
Contributor

Thank you for raising this issue. Since this issue was raised, we've published new versions of ResearchKit to main and haven't seen more info posted here. If you’re still seeing this issue in the latest release, please let us know, otherwise we will close it.
Thanks

@PSchmiedmayer
Copy link

PSchmiedmayer commented Feb 24, 2024

@louie-apple We are unfortunately experiencing the issue that the "other" text field does not show up in the latest version on the main branch. You can reproduce it by opening the ORKCatalog app and navigating to the "Text Choice Question". Selecting "Other" does not present the text field:

Interestingly it seems to work in the Form example:

We noted this as we were updating ResearchKitOnFHIR and detected that one of our automated tests failed and caught the regression.

@louie-apple
Copy link
Contributor

@PSchmiedmayer Thank you for sharing this with us! We are taking a look!

@PSchmiedmayer
Copy link

Thank you @louie-apple!

@louie-apple
Copy link
Contributor

Hi @PSchmiedmayer
We recently pushed a new release, 2.2.16 (https://github.com/ResearchKit/ResearchKit/releases/tag/2.2.16) on stable. Would you please pull this release and see if it resolves your issue?

@PSchmiedmayer
Copy link

Amazing, thank you @louie-apple; I will take a look at this later this week. Thanks for working on an update! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants