Skip to content

Commit

Permalink
🐛 Link newly created accessubility object to existing one while fixin…
Browse files Browse the repository at this point in the history
…g ancestor tree
  • Loading branch information
cma-oncomfort-ext committed Mar 9, 2023
1 parent 780ba56 commit 619b777
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,9 @@ private COSDictionary createMarkedContentDictionary() {

private void ensureAncestorTree(AbstractTreeItem child, Box parent) {
// Walk up the ancestor tree making sure they all have accessibility objects.
boolean newAccessibilityObjectCreated=false;
while (parent != null && parent.getAccessibilityObject() == null) {
newAccessibilityObjectCreated=true;
AbstractStructualElement parentItem = createStructureItem(null, parent);
parent.setAccessiblityObject(parentItem);

Expand All @@ -923,6 +925,11 @@ private void ensureAncestorTree(AbstractTreeItem child, Box parent) {
child = parentItem;
parent = parent.getParent();
}
if(newAccessibilityObjectCreated) {
AbstractStructualElement alreadyExistingAccessibilityObject = (AbstractStructualElement) parent.getAccessibilityObject();
child.parent = alreadyExistingAccessibilityObject;
alreadyExistingAccessibilityObject.addChild(child);
}
}

private AbstractStructualElement createStructureItem(StructureType type, Box box) {
Expand Down

0 comments on commit 619b777

Please sign in to comment.