Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Sep 8, 2020

…is outside of flutter

Description

We try to refocus the last focused semantics object when layout changes, but that does not take into account when the focus went outside of the flutter application (for example soft keyboard). This will interrupt the user focus and make the focus jump back to flutter.

This PR fixes it by making the semantics objects to notify the bridge when it lose focus, so that the bridge can accurately keep track of whether the focus has gone to outside of the app.

Related Issues

Fixes flutter/flutter#65423

Tests

I added the following tests:

see files

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM % couple nits

}

void AccessibilityBridge::AccessibilityObjectDidLoseFocus(int32_t id) {
if (last_focused_semantics_object_id_ == id)
Copy link
Member

Choose a reason for hiding this comment

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

Please add curly braces to make turning the linter on for mac easier.


void AccessibilityBridge::AccessibilityObjectDidLoseFocus(int32_t id) {
if (last_focused_semantics_object_id_ == id)
last_focused_semantics_object_id_ = -1;
Copy link
Member

Choose a reason for hiding this comment

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

Can you do a define for this magic value, something like kSemanticObjectIdInvalid?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focus shifts away from keyboard every time a new character is entered

3 participants