akvelon_flutter_issue_106664_workaround 0.1.2 akvelon_flutter_issue_106664_workaround: ^0.1.2 copied to clipboard
Fixes the Flutter issue of automatically scrolling to a focused iframe when clicking outside of such iframe
A workaround for Flutter Issue 106664
that locks the focus in iframe with TextField
if used in web.
Usage #
Add this to your main.dart
:
import 'package:akvelon_flutter_issue_106664_workaround/akvelon_flutter_issue_106664_workaround.dart';
void main() {
FlutterIssue106664Workaround.instance.apply();
// Continue your code.
}
copied to clipboard
The Workaround #
If not in web, do nothing.
If not in iframe, do nothing.
If Safari, do nothing because it is not affected.
If in Firefox, programmatically release focus on iframe's blur
event.
In Firefox it is sufficient. The downside is that selection is lost on clicking outside.
Otherwise programmatically release focus on iframe's mouseout
event.
In Chrome the solution for Firefox is insufficient. On the first outside click,
it still scrolls back to the iframe, and only the second click is free to leave the iframe.