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

Subtitle text not behaving as expected #1450

Closed
williamito opened this issue Jun 7, 2022 · 14 comments · Fixed by #1546 or #1574
Closed

Subtitle text not behaving as expected #1450

williamito opened this issue Jun 7, 2022 · 14 comments · Fixed by #1546 or #1574
Assignees
Labels
effort:small Small effort - 2 days P1 High priority issue type:bug Something isn't working

Comments

@williamito
Copy link
Contributor

williamito commented Jun 7, 2022

Case 1: The text "Correct!" appears twice, once incorrectly above the question "Cats are better than dogs", and once correctly based on the enableWhen element.

{
  "resourceType": "Questionnaire",
  "status": "active",
  "item": [
    {
      "linkId": "2",
      "text": "Demographic Information",
      "type": "group",
      "item": [
        {
          "linkId": "2.1",
          "text": "Cats are better than dogs",
          "type": "boolean"
        },
        {
          "linkId": "2.1.1",
          "text": "Correct!",
          "type": "display",
          "enableWhen": [
            {
              "question": "2.1",
              "operator": "=",
              "answerBoolean": true
            }
          ]
        }
      ]
    }
  ]
}

image

Case 2: When enableWhen is a child of the item, the "Correct!" text never appears. It still shows up incorrectly above the question, like in Case 1.

{
  "resourceType": "Questionnaire",
  "status": "active",
  "item": [
    {
      "linkId": "2",
      "text": "Demographic Information",
      "type": "group",
      "item": [
        {
          "linkId": "2.1",
          "text": "Cats are better than dogs",
          "type": "boolean",
          "item": [
            {
              "linkId": "2.1.1",
              "text": "Correct!",
              "type": "display",
              "enableWhen": [
                {
                  "question": "2.1",
                  "operator": "=",
                  "answerBoolean": true
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

image

This is using the published version of com.google.android.fhir:data-capture:0.1.0-beta03.

@jingtang10
Copy link
Collaborator

@PallaviGanorkar can you take a look at this please

@jingtang10 jingtang10 added P1 High priority issue Data capture labels Jun 7, 2022
@Tarun-Bhardwaj Tarun-Bhardwaj added type:bug Something isn't working effort:small Small effort - 2 days and removed Triage labels Jul 5, 2022
@santosh-pingle
Copy link
Collaborator

#1222

@PallaviGanorkar
Copy link
Contributor

PallaviGanorkar commented Jul 7, 2022

Case 2: As per issue 1113 and PR 1222, this behavior is as expected. i.e Showing Nested display item text as subtitle text.

@PallaviGanorkar
Copy link
Contributor

Case 1: Reproducible in version com.google.android.fhir:data-capture:0.1.0-beta03, but in latest code base its not reproducible, its working fine.

@williamito
Copy link
Contributor Author

For Case 2, I did not understand that it was considered subtitle text because the text "Correct!" is rendered the same as the other text on the questionnaire. The intended use would be more clear if the text styling was different.

That said, I think it is difficult to understand when something would be considered a subtitle vs a new text element. Can you describe how the rendering logic works based on the JSON structure for documentation purposes?

As an alternative, maybe we could use the displayCategory extension to make the rendering style decisions more explicit.

@williamito
Copy link
Contributor Author

In addition, the display of "Correct!" does not appear to respect the enableWhen.

image

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

@jingtang10
Copy link
Collaborator

For Case 2, I did not understand that it was considered subtitle text because the text "Correct!" is rendered the same as the other text on the questionnaire. The intended use would be more clear if the text styling was different.

That said, I think it is difficult to understand when something would be considered a subtitle vs a new text element. Can you describe how the rendering logic works based on the JSON structure for documentation purposes?

As an alternative, maybe we could use the displayCategory extension to make the rendering style decisions more explicit.

i agre with this. maybe we should use display category.

maybe we should use "instructions" http:https://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10
Copy link
Collaborator

@shelaghm
Copy link

shelaghm commented Jul 21, 2022

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

@williamito @jingtang10 @santosh-pingle This is a great call out. I agree they should render differently. From what I'm aware of we don't have a "section header" text style. I have some old mocks where we have this type of text rendering above a question. See below
I'd recommend we use the "Title Medium - Roboto 16 Medium" text style. @santosh-pingle any questions/issues with implementing this type of section header text style?

Screen Shot 2022-07-21 at 06 01 59

@shelaghm
Copy link

i agre with this. maybe we should use display category.
maybe we should use "instructions" http:https://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito

The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

@jingtang10 jingtang10 changed the title enableWhen text not behaving as expected Subtitle text not behaving as expected Jul 22, 2022
@santosh-pingle
Copy link
Collaborator

Looking into it. thanks!

@santosh-pingle
Copy link
Collaborator

santosh-pingle commented Aug 5, 2022

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

@williamito @jingtang10 @santosh-pingle This is a great call out. I agree they should render differently. From what I'm aware of we don't have a "section header" text style. I have some old mocks where we have this type of text rendering above a question. See below I'd recommend we use the "Title Medium - Roboto 16 Medium" text style. @santosh-pingle any questions/issues with implementing this type of section header text style?

Screen Shot 2022-07-21 at 06 01 59

working on it.

@santosh-pingle
Copy link
Collaborator

i agre with this. maybe we should use display category.
maybe we should use "instructions" http:https://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito

The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

We can provide implementation. thanks!

@santosh-pingle
Copy link
Collaborator

i agre with this. maybe we should use display category.
maybe we should use "instructions" http:https://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito
The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

We can provide implementation. thanks!

looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:small Small effort - 2 days P1 High priority issue type:bug Something isn't working
Projects
Status: Complete
6 participants