Skip to content

ModalRoute resumes previous focus on didPopNext - #33152

Merged
dkwingsmt merged 8 commits into
flutter:masterfrom
dkwingsmt:modal-resume-focus
May 31, 2019
Merged

dkwingsmt merged 8 commits into
flutter:masterfrom
dkwingsmt:modal-resume-focus

Conversation

@dkwingsmt

@dkwingsmt dkwingsmt commented May 21, 2019 •

Copy link
Copy Markdown
Contributor

Description

This PR changes ModalRoute so that, when the route on top of it is popped, it requests to focus on the last focus.

Currently when the user is editing something, the edit will be interrupted by popups or dialogs. After this PR, the edit will be resumed after the popup or dialog is closed. See the following example:

Before:
before

After:
after

Related Issues

None

Tests

I added the following tests:

  • When a ModalRoute finds the route on top of it is popped, it resumes its last focus.
    • In the test, instead of ModalRoute and Route, we used PageRoute and DialogRoute, which might leave a risk, but otherwise we would have to build a ton of things from scratch.

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 Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@goderbauer goderbauer added the framework flutter/packages/flutter repository. See also f: labels. label May 23, 2019
Comment thread packages/flutter/test/widgets/routes_test.dart
@goderbauer

Copy link
Copy Markdown
Member

@gspencergoog Can you take a look at this since you recently worked with the focus sub-system?

@gspencergoog gspencergoog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@dkwingsmt
dkwingsmt merged commit 0f2254a into flutter:master May 31, 2019
@dkwingsmt
dkwingsmt deleted the modal-resume-focus branch May 31, 2019 21:15
@tvolkert

tvolkert commented Jun 4, 2019

Copy link
Copy Markdown
Contributor

This change was identified as causing tests to fail inside Google. Since other teams are blocked on the roll, we'll have to investigate tomorrow what the underlying cause is (it's possible that the test is doing something wrong, or it's possible there's a bug in this PR). For now, I'm going to revert to unblock the roll.

tvolkert added a commit that referenced this pull request Jun 4, 2019
tvolkert added a commit that referenced this pull request Jun 4, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants