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

Fix a11y update when insert view #1327

Merged

Conversation

wsdwsd0829
Copy link
Contributor

No description provided.

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Max – could you write down the motivation here?

Since not all nodes are backed by _ASDisplayViews (wrapper nodes) should we move this into something like _addSubnode: or a place that is a tighter funnel?

@wsdwsd0829
Copy link
Contributor Author

As I tested the insertView will be called instead of addSubview below even for the view hierarchy is created first time. Another case is when view tree is updated by removing and inserting a new image node for example, the new image node will not have a11y info without this change.

@Adlai-Holler
Copy link
Member

That makes sense but if we put the code in _addSubnode: (not addSubview:) on ASDisplayNode, I think we can cover layer backed nodes and wrapper nodes at the same time. Something along the lines of:

- (void)_addSubnode:(ASDisplayNode *)node {
  // other code
  if (node->_layer) {
    // Find nearest view above (self or parent).
    nearestView.accessibilityElements = nil;`
  }
}

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max pointed out to me that the other ASDisplayView subclass methods also follow this pattern, so I think this diff is quite safe.

@Adlai-Holler Adlai-Holler merged commit 5f1dc2b into TextureGroup:master Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants