Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26706

Android: AccessibilityLabel is on wrong element

    Details

    • Story Points:
      5
    • Sprint:
      2021 Sprint 5, 2021 Sprint 6, 2021 Sprint 7, 2021 Sprint 8, 2021 Sprint 9, 2021 Sprint 10, 2021 Sprint 11, 2021 Sprint 14, 2021 Sprint 12, 2021 Sprint 13

      Description

      Here is an appium project (it is not needed, but useful): https://github.com/joshmocekMovista/AccessibiltyLabel_Bug
      Here is the titanium app: https://github.com/joshmocekMovista/accessLabelBug

      Use the files that I had for the titanium app. You will notice that there are accessibilityLabels on multiple elements in the XML. So far the accessibilityLabels work somewhat on iOS. On Android they are currently showing up on Labels, but you will notice that they are on the wrong element on "TextFields" and "ImageViews". You can inspect the elements with appium or with the Android Tool UIAutomatorViewer.

      Reference "textInputLayout-editText.png", "editText.png", "appium-TextInputLayout.png", and "appium-editText.png".

      Here is the titanium XML:

      <TextField accessibilityLabel="textField" />
      

      On "TextFields" instead of being on the <EditText> element it is on the parent and looks like (disclaimer Android add a '.' to the accessibilityLabels:

      <TextInputLayout content-desc="textField.">
          <FrameLayout>
             <EditText />
          </FrameLayout>
      </TextInputLayout>
      

      This messes up automated testing since in selenium I want to run the same code for iOS and Android (it works on iOS currently). Here is they python code I run in selenium to add text to a <TextField> in iOS this works on Android it can't send the keys because it is trying to send the keys to the <TextInputLayout> element instead of <EditText> element:

      context.driver.find_element_by_accessibility_id('textField.').send_keys('text added by automated test')
      

      I think the Android XML should look like this:

      <TextInputLayout>
          <FrameLayout>
              <EditText content-desc="textField." />
          </FrameLayout>
      </TextInputLayout>
      

      This is also a problem with the <ImageView> element. Reference "viewGroup-imageView.png" and "imageView.png". You will notice that the accessibilityLabel is on the <ViewGroup> element instead of the <ImageView> element. The Android looks like this:

      <ViewGroup content-desc="textField.">
          <ImageView />
      </ViewGroup>
      

      I think it should look like this:

      <ViewGroup>
          <ImageView content-desc="textField." />
      </ViewGroup>
      

      Once again this works on iOS and it doesn't on Android because it doesn't find the correct element because the "accessibilityLabel" is tied to the <ViewGroup> element instead of the <ImageView> element.

        Attachments

        1. appium-editText.png
          appium-editText.png
          562 kB
        2. appium-TextInputLayout.png
          appium-TextInputLayout.png
          498 kB
        3. edtiText.png
          edtiText.png
          533 kB
        4. imageView.png
          imageView.png
          494 kB
        5. index.js
          0.8 kB
        6. index.tss
          0.2 kB
        7. index.xml
          1 kB
        8. textInputLayout-editText.png
          textInputLayout-editText.png
          510 kB
        9. tiapp.xml
          4 kB
        10. viewGroup-imageview.png
          viewGroup-imageview.png
          488 kB

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                josh.mocek josh.mocek
                Reviewer:
                Joshua Quick
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-6809
                    Sync status:
                    PENDING
                    Last received:
                    Last sent:

                    Git Integration