Incorrect accessibility hierarchy on XCUIApplication

Originator:pablobart
Number:rdar://FB9903725 Date Originated:14/2/2022
Status:Open Resolved:
Product:XCTest Product Version:
Classification: Reproducible:
 
XCUIApplication incorrectly builds the accessibility hierarchy when UITableView section headers have subviews. 

For example, in a table view with two tableview section headers, each one containing a UIStackView with two UILabels, the accessibility hierarchy duplicates the UITableView section header subviews and place them in the accessibility hierarchy at the same level as the UITableViewCells:

 →Application, 0x7f9e0ff21f30, pid: 86321, label: 'xcuitest-bug'
    Window (Main), 0x7f9e0ff48840, {{0.0, 0.0}, {390.0, 844.0}}
      Other, 0x7f9e0ff44550, {{0.0, 0.0}, {390.0, 844.0}}
        Other, 0x7f9e11813c40, {{0.0, 0.0}, {390.0, 844.0}}
          Table, 0x7f9e118319b0, {{0.0, 0.0}, {390.0, 844.0}}
            Other, 0x7f9e11831ac0, {{0.0, 69.0}, {390.0, 20.3}}, identifier: 'First label'
CORRECT -->   StaticText, 0x7f9e1182b730, {{0.0, 69.0}, {291.7, 20.3}}, identifier: 'label1-id', label: 'First label'
CORRECT -->   StaticText, 0x7f9e1182b840, {{291.7, 69.0}, {98.3, 20.3}}, identifier: 'label2-id', label: 'Second label'
            Cell, 0x7f9e1183eb50, {{0.0, 89.3}, {390.0, 44.0}}
              Other, 0x7f9e1183ec60, {{20.0, 89.3}, {370.0, 0.3}}
              Other, 0x7f9e11917870, {{0.0, 89.3}, {390.0, 44.0}}
                Other, 0x7f9e0ff43d30, {{0.0, 89.3}, {390.0, 44.0}}
              Other, 0x7f9e0ff20710, {{20.0, 133.0}, {370.0, 0.3}}
            Cell, 0x7f9e0ff42c80, {{0.0, 133.3}, {390.0, 44.0}}
              Other, 0x7f9e1182f5c0, {{0.0, 133.3}, {390.0, 44.0}}
                Other, 0x7f9e11916180, {{0.0, 133.3}, {390.0, 44.0}}
              Other, 0x7f9e119195e0, {{20.0, 177.0}, {370.0, 0.3}}
            Other, 0x7f9e11918a30, {{0.0, 199.3}, {390.0, 20.3}}, identifier: 'First label'
CORRECT -->   StaticText, 0x7f9e1190c680, {{0.0, 199.3}, {291.7, 20.3}}, identifier: 'label1-id', label: 'First label'
CORRECT -->   StaticText, 0x7f9e119209f0, {{291.7, 199.3}, {98.3, 20.3}}, identifier: 'label2-id', label: 'Second label'
            Cell, 0x7f9e11921b10, {{0.0, 219.7}, {390.0, 44.0}}
              Other, 0x7f9e119242b0, {{20.0, 219.7}, {370.0, 0.3}}
              Other, 0x7f9e1191e1c0, {{0.0, 219.7}, {390.0, 44.0}}
                Other, 0x7f9e1191e2d0, {{0.0, 219.7}, {390.0, 44.0}}
              Other, 0x7f9e119267a0, {{20.0, 263.3}, {370.0, 0.3}}
            Cell, 0x7f9e0ff3a810, {{0.0, 263.7}, {390.0, 44.0}}
              Other, 0x7f9e0ff18930, {{0.0, 263.7}, {390.0, 44.0}}
                Other, 0x7f9e1182f6d0, {{0.0, 263.7}, {390.0, 44.0}}
              Other, 0x7f9e11807970, {{20.0, 307.3}, {370.0, 0.3}}
INCORRECT -> StaticText, 0x7f9e11a19ea0, {{0.0, 69.0}, {291.7, 20.3}}, identifier: 'label1-id', label: 'First label'
INCORRECT -> StaticText, 0x7f9e11a15330, {{291.7, 69.0}, {98.3, 20.3}}, identifier: 'label2-id', label: 'Second label'
INCORRECT -> StaticText, 0x7f9e11a22880, {{0.0, 199.3}, {291.7, 20.3}}, identifier: 'label1-id', label: 'First label'
INCORRECT -> StaticText, 0x7f9e11807a80, {{291.7, 199.3}, {98.3, 20.3}}, identifier: 'label2-id', label: 'Second label'

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!