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

AttributedLabel Link Accessibility #459

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RoyalPineapple
Copy link
Collaborator

@RoyalPineapple RoyalPineapple commented May 30, 2023

Updating attributed label's links to more closely mirror the SwiftUI accessibility experience

SwiftUI.Link.mp4

This is our current implementation, which doesn't announce links properly.

WithoutLinks.mov

Here is the new version, announcing links as they are read.

WithLinks.mp4

@RoyalPineapple RoyalPineapple force-pushed the alex/LinkAccessibility branch 2 times, most recently from bc23c22 to e6457d0 Compare June 8, 2023 17:00
@RoyalPineapple RoyalPineapple marked this pull request as ready for review June 29, 2023 17:34
@RoyalPineapple RoyalPineapple requested a review from a team as a code owner June 29, 2023 17:34
@kyleve
Copy link
Collaborator

kyleve commented Nov 29, 2023

It looks like there's some failing tests:

Failing tests:

	AttributedLabelTests.test_linkAttribute()
	AttributedLabelTests.test_textContainerRects()

let localizedLinkString = linkAccessibilityLabel,
!links.isEmpty else { return }

let insertionString = "[\(localizedLinkString)] "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do the [ ] have any special meaning here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

its really only for the case where the string would be printed. e.g. the accessibility inspector. I wanted to be clear that it's not a part of the displayed text. and that it's explicitly associated with the link string (it doesn't have a preceding space).

I chose the square brackets because

  • Voiceover doesn't read the [] characters, but does realize the contained word is distinct from the preceding word.
  • They aren't often used in prose, unlike parenthesis. They're unlikely to be confused with the actual content
  • They look like markdown.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense! It might be good to capture that in a comment inline

@RoyalPineapple RoyalPineapple force-pushed the alex/LinkAccessibility branch 2 times, most recently from ec73157 to 736cd9e Compare November 30, 2023 17:28
@RoyalPineapple RoyalPineapple force-pushed the alex/LinkAccessibility branch 2 times, most recently from e4b2c34 to 4fc6b4b Compare November 30, 2023 20:21
@RoyalPineapple RoyalPineapple marked this pull request as ready for review November 30, 2023 22:47
@RoyalPineapple
Copy link
Collaborator Author

RoyalPineapple commented Dec 5, 2023

Replaced with #473

@robmaceachern
Copy link
Member

@RoyalPineapple Moving to draft because I think this was addressed elsewhere but feel free to reopen if needed!

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.

None yet

3 participants