Repository navigation
Conversation
Text inside a Link node now carries NSAccessibilityLinkTextAttribute (AXLink) in accessibilityAttributedStringForRange:, whose value is the link's own platform element. This is how AppKit text views expose hypertext, and it lets an assistive technology announce and reach an inline link while reading the surrounding text.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
accessibilityAttributedStringForRange:returns font, colour, decoration and language attributes, but nothing marks text that belongs to a link. AppKit's own text views mark it withNSAccessibilityLinkTextAttribute(AXLink), whose value is the link element; assistive technologies use it to announce and reach inline links while reading a paragraph.This PR adds that attribute: for each text run in the range, if the run has a
Role::Linkancestor below the node being queried, the run's attributes includeAXLinkset to that link's platform node.Testing
On macOS 27 (Apple silicon), with a winit host exposing a paragraph as a
LabelwhoseTextRunchildren include runs inside aLinknode, queried throughAXUIElement:AXAttributedStringForRangeover the whole paragraph carries noAXLinkattribute;AXLink, and its value is the same element as the paragraph'sAXLinkchild.cargo fmt --check,cargo clippy -p accesskit_macos --all-targets -- -D warningsandcargo test -p accesskit_macospass. The adapter has no unit tests to extend; I have not built with Rust 1.87 locally, and nothing here uses newer language or library features. VoiceOver itself has not yet been run against this build.