Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Copy Shortcut does not work if TextField outside of WebView has focus #2380

Closed
1 of 2 tasks
marcosgcd opened this issue Oct 29, 2024 · 3 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@marcosgcd
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When a user has focus on a Flutter TextField and tries to copy text from a WebView, nothing gets copied.

I attempted to fix this issue by adding the following code:

onWindowFocus: (
    FocusScope.of(context).unfocus();
},

This solution worked for the first copy, but it didn’t consistently resolve the problem afterward.

Expected Behavior

Copy should work without any extra code outside of InAppWebView

Steps with code example to reproduce

Steps with code example to reproduce

I could reproduce the issue on with example from: https://github.com/pichillilorenzo/flutter_inappwebview/blob/master/flutter_inappwebview/example/lib/in_app_webiew_example.screen.dart

  1. Start The Example project (I used MacOS)
  2. Click in Url TextField
  3. Try to copy something from the WebView. Don't click anything else to not remove the focus from the textfield manually
  4. Try paste copied text

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

3.24.3

Operating System, Device-specific and/or Tool

macOS

Plugin version

6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@marcosgcd marcosgcd added the bug Something isn't working label Oct 29, 2024
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Nov 4, 2024

It seems there is an issue with the native Flutter PlatformView itself on macOS!
The same problem occurs also with the webview_flutter plugin, so you should open a new issue to the official Flutter repository.
You can also reference this issue.

In the meantime, I was able somehow to create a workaround for it on the native side, but this is something that should be fixed natively on Flutter itself.
This workaround should be available in the next 6.2.0 version

@pichillilorenzo pichillilorenzo changed the title [Desktop] Copy Shortcut does not work if TextField outside of WebView has focus [macOS] Copy Shortcut does not work if TextField outside of WebView has focus Nov 4, 2024
@pichillilorenzo pichillilorenzo changed the title [macOS] Copy Shortcut does not work if TextField outside of WebView has focus [macOS] Copy Shortcut does not work if TextField outside of WebView has focus Nov 4, 2024
pichillilorenzo added a commit that referenced this issue Nov 4, 2024
…and clearFocus WebView methods, implemented workaround for macos #2380
@pichillilorenzo
Copy link
Owner

Released new version 6.2.0-beta.1.

hson252850 pushed a commit to hson252850/flutter_inappwebview that referenced this issue Nov 7, 2024
…and clearFocus WebView methods, implemented workaround for macos pichillilorenzo#2380
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants