Skip to content

Conversation

fruitcoder
Copy link
Contributor

Check whether node has accessibilityElementsHidden set before returning accessibilityElements to UIKit

# Conflicts:
#	Source/Details/_ASDisplayViewAccessiblity.mm
#	Source/Private/ASDisplayNode+UIViewBridge.mm
#	Source/Private/_ASPendingState.mm
@ghost
Copy link

ghost commented Feb 8, 2018

🚫 CI failed with log

Copy link
Member

@appleguy appleguy left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this!

// XCTAssertEqualObjects(@"Awesome things will happen", node.accessibilityAttributedHint.string, @"accessibilityAttributedHint is broken %@", hasLoadedView);
// XCTAssertEqualObjects(@"1 of 2", node.accessibilityAttributedValue.string, @"accessibilityAttributedValue is broken %@", hasLoadedView);
// }
if (@available(iOS 11.0, *)) {
Copy link
Member

Choose a reason for hiding this comment

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

This might break some build systems on Xcode 8.3. We'll adopt this soon, but it should be done as a single diff rather than in smaller changes. Could you keep AS_AT_LEAST_IOS11 for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea where this comes from tbo. I know I had that when submitting my last PR but you changed it and I thought pulling from master would keep your changes. Will change this back next week!

@appleguy appleguy changed the title A11y hidden elements [ASDisplayNode] Ensure accessibilityElementsHidden is respected before returning accessibilityElements to UIKit. Feb 9, 2018
@appleguy
Copy link
Member

Thanks @fruitcoder! I'll merge this as soon as the CI lets me...

@appleguy
Copy link
Member

@maicki @Adlai-Holler it appears there are ongoing reliability problems with CI. Is there any way I can be added as an admin for this project in order to be able to trigger build restarts? It's definitely the top issue affecting developer velocity for GitHub contributors right now.

If you guys can push this without waiting on CI or otherwise get it to run, it would be great to close this out.

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

LGTM

@maicki
Copy link
Contributor

maicki commented Feb 21, 2018

@garrettmoon Can you help out with the question from @appleguy

@appleguy
Copy link
Member

@garrettmoon I know you're very busy right now - no worries if it takes a little while to get to this. We do have a whole lot of PRs blocked on CI though, and it would be good to at least disable the blocking aspect of it to allow dev to continue if it's not practical to fix the CI soon.

Specifically this would be only for people with authorization to merge. I think we can self-police to make sure things build during the review process, as there would be extra caution used when operating without CI.

@fruitcoder
Copy link
Contributor Author

I just noticed a problem using my fork #a11yHiddenElements with my current project. It might be my setup but after I set a node's accessibilityElementsHidden to true once it won't let me focus any subnode after setting the property back to false. It's like it either cached the flag or UIKit doesn't ask for a11y elements again.

@nguyenhuy
Copy link
Member

@fruitcoder Did you figure out the problem you mentioned above? Should we go ahead and merge this PR?

@fruitcoder
Copy link
Contributor Author

@nguyenhuy Don‘t merge! I still haven‘t found out why the a11y elements aren‘t coming back when accessibilityElementsHidden is set back to true but I am out of clues why that is 😔 do you have any idea what could cause this?

Sent with GitHawk

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.

Marking as request-changes so we know not to land until we figure this out.

I don't have any bandwidth right now to dig into this with you in the next few days @fruitcoder, sorry! I really wish I did 😞

@maicki has a lot of experience working with accessibility. Maybe he can look at it?

@appleguy
Copy link
Member

@fruitcoder let us know if you had any other observations here. It would be great to merge if possible, though we should probably close out if there is an investigation needed that we don't have time to pursue.

@fruitcoder
Copy link
Contributor Author

I just tried to run the branch again and the results are the same. After setting the accessibilityElementsHidden to false once they won't come back. This seems to be an issue with isAccessibilityElement as well. The functions that collect the elements aren't called again.
Still no idea why that is and I'm sorry but I won't have the time to look more into this :(

@fillky
Copy link

fillky commented May 6, 2019

Having the same issue in a different project. Was playing around UIAccessibility.post(notification: .layoutChanged, argument: nil) but unfortunately still not working 🙆🏻‍♂️.

rcancro added a commit to rcancro/Texture that referenced this pull request Jun 1, 2020
Most of this code comes from an old PR that @fruitcoder put up TextureGroup#795 2 years ago.

When creating our array of accessibilityElements, we need to respect the value of `accessibilityElementsHidden`. If the value of this property changes, we need to invalidate the cached accessibility elements (unless we are in the experiment that doesn’t cache `accessibilityElements`).

I created a simple test app and made sure this matched UIKit’s implementation. I also added a test case that changes the value of `accessibilityElementsHidden` and makes sure the proper accessibilityElements are returned.
@rcancro
Copy link
Contributor

rcancro commented Jun 1, 2020

I was having similar issues with cached accessibility elements when working on accessibilityViewIsModal. Since the accessibility code has changed a bit since 2 years ago, I put up a new PR that adds accessibilityElementsHidden. #1859. If that one lands, I'll close this one.

rcancro added a commit that referenced this pull request Jun 3, 2020
Most of this code comes from an old PR that @fruitcoder put up #795 2 years ago.

When creating our array of accessibilityElements, we need to respect the value of `accessibilityElementsHidden`. If the value of this property changes, we need to invalidate the cached accessibility elements (unless we are in the experiment that doesn’t cache `accessibilityElements`).

I created a simple test app and made sure this matched UIKit’s implementation. I also added a test case that changes the value of `accessibilityElementsHidden` and makes sure the proper accessibilityElements are returned.
@rcancro
Copy link
Contributor

rcancro commented Jun 3, 2020

#1859 landed, so hopefully accessibilityElementsHidden works now!

@rcancro rcancro closed this Jun 3, 2020
piotrdebosz pushed a commit to getstoryteller/Texture that referenced this pull request Mar 1, 2021
)

Most of this code comes from an old PR that @fruitcoder put up TextureGroup#795 2 years ago.

When creating our array of accessibilityElements, we need to respect the value of `accessibilityElementsHidden`. If the value of this property changes, we need to invalidate the cached accessibility elements (unless we are in the experiment that doesn’t cache `accessibilityElements`).

I created a simple test app and made sure this matched UIKit’s implementation. I also added a test case that changes the value of `accessibilityElementsHidden` and makes sure the proper accessibilityElements are returned.
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.

7 participants