-
Notifications
You must be signed in to change notification settings - Fork 6k
a11y: Add SemanticsAction "showOnScreen" #3856
Conversation
This action is triggered when the user swipes (in accessibility mode) to the last visible item of a scrollable list to bring that item fully on screen. iOS implementation to follow.
@@ -77,7 +78,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { | |||
|
|||
AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); | |||
result.setPackageName(mOwner.getContext().getPackageName()); | |||
result.setClassName("Flutter"); // Prettier than the more conventional node.getClass().getName() | |||
result.setClassName("Flutter"); // TODO(goderbauer): Set proper class names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android TalkBack uses the class to determine how to behave (for an example see below where I set the class to ScrollView to get the correct scroll behavoir). And if you set the class to button for example, Android talkback will correctly announce that it is a button. There are more classes with special meaning, apparently.
Does this mean you found the magic way that lists get scrolled? |
@@ -117,6 +118,9 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { | |||
result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); | |||
result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); | |||
result.setScrollable(true); | |||
// This tells Android's a11y to send scroll events when reaching the end of | |||
// the visible viewport of a scrollable. | |||
result.setClassName("android.widget.ScrollView"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. The magic is to fake which class you are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's exactly it.
This action is triggered when the user swipes (in accessibility mode) to the last visible item of a scrollable list to bring that item fully on screen. This requires engine rolled to flutter/engine#3856. I am in the process of adding tests, but I'd like to get early feedback to see if this approach is OK.
* a11y: implement new SemanticsAction "showOnScreen" (v2) This action is triggered when the user swipes (in accessibility mode) to the last visible item of a scrollable list to bring that item fully on screen. This requires engine rolled to flutter/engine#3856. I am in the process of adding tests, but I'd like to get early feedback to see if this approach is OK. * fix null check * review comments * review comments * Add test * fix analyzer warning
This action is triggered when the user swipes (in accessibility mode) to the last visible item of a scrollable list to bring that item fully on screen.
iOS implementation to follow.
Addresses flutter/flutter#1714 for Android.