Skip to content

Bring back paste button hide behavior 3#57139

Merged
fluttergithubbot merged 4 commits intoflutter:masterfrom
justinmc:pasteable-revert-revert-3
May 14, 2020
Merged

Bring back paste button hide behavior 3#57139
fluttergithubbot merged 4 commits intoflutter:masterfrom
justinmc:pasteable-revert-revert-3

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented May 13, 2020

First Try

I wrote the original PR #54902 and merged it when it was green.

The integration test android_semantics_testing failed after it was merged, so it was reverted. I ran the integration test locally and found that it did fail in the same way locally (using a physical Pixel 2).

Second Try

I fixed the integration test failure by updating the expected semantics options, and I added an extra case that specifically tests the behavior in this PR. Then I created a new PR with this changed reverting the revert and merged it.

The integration test passed and the build went green after the merge. However, during the next roll, there were errors in google3 with a stacktrace pointing to my code, so it was reverted.

Third Try

I identified and fixed the problem in my code. Then I created and merged a PR with this change reverting the previous reversion.

I didn't rerun the integration test at the time, because nothing should have changed related to it, but running it on this branch now I see that it fails again. The failure seems to have nothing to do with the change that I made in this PR. I'm guessing it is related to something that changed in master in the time between the two PRs.

This Fourth Try

I undid my original changes to the integration test since it now seems to pass without those changes. I kept my extra case for this PR, though. The integration test now passes locally.

@justinmc justinmc self-assigned this May 13, 2020
@fluttergithubbot fluttergithubbot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels May 13, 2020
@justinmc justinmc requested a review from goderbauer May 13, 2020 18:03
@goderbauer
Copy link
Member

Wondering: Maybe the previous run of the integration test is affecting the next? E.g. during the previous run you copied something into the text field. So during the next run, the clipboard doesn't appear empty anymore and the test (expecting it to be empty) fails.

With this change, the test will now fail if the clipboard happens to be empty at the start of the test. So, I think it is still flaky. Can we set the clipboard state to a known state at the beginning of the test? Ideally, we would clear it to test both cases: a full and an empty clipboard. Is there a command to clear the textfield that we could execute at the beginning of the test?

@justinmc
Copy link
Contributor Author

I bet you're right! It seemed to be flaky, but when I ran it over and over it again it always gave the same result (because the clipboard status didn't change between runs). I assumed it would start empty like in the unit tests, but I'll look for a way to clear it manually.

@justinmc
Copy link
Contributor Author

@goderbauer I've updated it to copy some text into the clipboard for the relevant integration tests and it seems to work. It passes whether or not the clipboard is empty before running the test.

I found no reliable way to clear the clipboard except for restarting the device. So, I'm not testing the case where there is nothing in the clipboard, I'm just making sure there is definitely something pasteable on the clipboard. When I do that, the integration tests pass without any further migration needed, as I would expect.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM


// The text selection menu and related semantics vary depending on if the
// clipboard contents are pasteable. Copy some text into the clipboard to
// make sure these tests always run with pasteable content in the clipboard.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add that ideally we would want to run the tests with an empty clipboard as well, but there is no reliable way to clear the clipboard.

@nturgut
Copy link
Contributor

nturgut commented May 15, 2020

@justinmc @goderbauer
Can we please revert back this PR? This causes Flutter for Web to fail.

We caught it in our integration tests: https://ci.chromium.org/p/flutter/builders/try/Linux%20Web%20Engine/4099?

These tests only run on the engine side so we were able to catch it only now.

Overall getData means paste, reading the clipboard on web, which requires permission and should only be done with user permission. Calling getData will bring a browser popup window and will ask user for permission. It is not the best practice to ask user for their clipboard's access without an explicit event that might trigger it. Let's discuss a solution that will also work for web before remerging this PR.

nturgut pushed a commit that referenced this pull request May 15, 2020
@justinmc justinmc deleted the pasteable-revert-revert-3 branch May 15, 2020 15:08
nturgut pushed a commit that referenced this pull request May 15, 2020
justinmc added a commit to justinmc/flutter that referenced this pull request May 15, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) c: contributor-productivity Team-specific productivity, code health, technical debt. f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants