Skip to content

Fix setting onFocus callback for SemanticsAction.focus on iOS. #149838

@gspencergoog

Description

@gspencergoog

Description

In trying to land #142942, the iOS platform view test failed, so it was reverted.

Jen (@jmagman ), Yegor (@yjbanov) and I have tried debugging this and reached this level of understanding of the bug.

Jen explained in this comment the details we've discovered so far: #149741 (comment)

I've reached the limit in the amount of time I can devote to this, so I'm going to just prevent setting the callback on iOS (where it isn't expected to do anything anyhow), and submit it for other platforms, and we can debug it at our leisure.

The behavior is definitely very odd: Setting the onFocus callback for the Semantics node in the Focus widget in the framework causes the native iOS text field in the platform view UI integration test to shift left by 93 pixels so that it's lower left corner is outside of the bounding box for the platform view, consequently making it not possible to scroll it into view when the test tries to tap on it. If the callback isn't set, it doesn't move the text field. I'm going to mention again that it's not a Flutter text field, it's the native iOS text field inside the platform view that is shifting position, just for emphasis.

In no way does this make sense to me, and it should be debugged to find out the root cause, since I suspect it is a deeper bug lurking in the iOS engine, but since iOS isn't expected to send focus events separate from accessibility focus events, the callback wouldn't ever get called anyhow.

For now, I'm filing this issue and attaching it to a TODO in the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)engineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions