-
Notifications
You must be signed in to change notification settings - Fork 6k
Support scrolling in iOS accessibility #26671
Conversation
This comment has been minimized.
This comment has been minimized.
|
This makes scrollable work natively in iOS, this however makes the scrollable focusable in voiceover. I think this is ok because that matches the UIScrollView in native App if you want it to be scrollable. |
| - (void)accessibilityBridgeDidFinishUpdate; | ||
|
|
||
| /** Should only be called in conjunction with setting child/parent relationship. */ | ||
| - (void)setParent:(SemanticsObject*)parent; |
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.
Instead of providing this method, switch the property away from readonly and make sure the memory semantics are clear i.e. is this retaining a weak or strong reference?
| /// iOS. | ||
| @interface FlutterScrollableSemanticsObject : UIScrollView | ||
|
|
||
| - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject; |
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.
Add NS_UNAVAILABLE init and NS_DESIGNATED_INITIALIZER for this initializer to force people to use this initializer.
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.
The initWithSemanticsObject still uses init, I can't NS_UNAVAILABLE the init?
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.
nvm i got it
| return globalTransform; | ||
| } | ||
|
|
||
| void ApplyTransform(SkPoint& point, const SkM44& transform) { |
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.
Instead of mutating the parameter, just return a new SkPoint. That leads to more clear usage.
| @end // FlutterSwitchSemanticsObject | ||
|
|
||
| @implementation FlutterScrollableSemanticsObject { | ||
| SemanticsObject* _semanticsObject; |
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.
Please move this to a property so the memory semantics are explicit.
| } | ||
|
|
||
| - (id)accessibilityContainer { | ||
| if (_container == nil) |
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.
Add curly braces please https://google.github.io/styleguide/objcguide.html#conditionals
| /** Should only be called in conjunction with setting child/parent relationship. */ | ||
| - (void)privateSetParent:(SemanticsObject*)parent; |
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 get rid of this flimsy protection?
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.
the parent become a public property, do we still want to keep this?
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.
I would. I admit it is flimsy but it at least brings attention to it.
|
|
||
| void AccessibilityBridge::VisitObjectsRecursivelyAndRemove(SemanticsObject* object, | ||
| NSMutableArray<NSNumber*>* doomed_uids) { | ||
| [object accessibilityBridgeDidFinishUpdate]; |
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.
The name of this method doesn't seem to match to me with where it is being called. If i had to name it I'd call it accessibilityBridgeWillVisitObjectsRecursivelyAndRemove, know what I mean?
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.
The accessibilityBridgeWillVisitObjectsRecursivelyAndRemove name is vague and is hard to interpret. I put it in VisitObjectsRecursivelyAndRemove because I don't want to do another tree walk just to call this method.
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.
The problem with what it is called now is that is leaking context information about where VisitObjectsRecursivelyAndRemove is called into calls higher in the call stack. Would it make more sense to move that to where VisitObjectsRecursivelyAndRemove is being called? Maybe you could make a method like this:
void finishUpdating(bridge, object) {
doomed_uids = calculateDoomedUids();
[object accessibilityBridgeDidFinishUpdate];
bridge->VisitObjectsRecursivelyAndRemove(object, doomed_uids);
}
That would make the name make more sense.
|
@gaaclarke PTAL :) |
| - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject { | ||
| self = [super initWithFrame:CGRectZero]; | ||
| if (self) { | ||
| self.semanticsObject = semanticsObject; |
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.
You should use _semanticsObject = [semanticsObject retain]; You aren't suppose to reference properties through self in init methods.
gaaclarke
left a comment
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.
LGTM modulo those 2 comments.
This reverts commit e56dd3a.
…ter#26803) This reverts commit e56dd3a.
…ter#26803) This reverts commit e56dd3a.
Fixes scrolling issues once and for all
Use a UIScrollView to represent scroll view in iOS accessibility.
fixes flutter/flutter#80711
fixes flutter/flutter#37974
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.