The issue with incorrectly counted header elements comes due to the reason that the main table considers the TH elements as child elements no matter if they are nested in a second table. You can find attached a simple project with the fixed AccessibleTable dialog set as external.