Commit c05e0e39 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

updated DropDown workaround: load it as soon as possible and load also for...

updated DropDown workaround: load it as soon as possible and load also for iframes where possibile (same origin)
parent 9b85ae9c
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Android API 24 Platform" project-jdk-type="Android SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Android API 28 Platform" project-jdk-type="Android SDK" />
<component name="ProjectType"> <component name="ProjectType">
<option name="id" value="io.flutter" /> <option name="id" value="io.flutter" />
</component> </component>
......
This diff is collapsed.
...@@ -410,7 +410,7 @@ Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly: ...@@ -410,7 +410,7 @@ Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
* `hardwareAcceleration`: Boolean value to enable Hardware Acceleration in the WebView. * `hardwareAcceleration`: Boolean value to enable Hardware Acceleration in the WebView.
* `supportMultipleWindows`: Sets whether the WebView whether supports multiple windows. * `supportMultipleWindows`: Sets whether the WebView whether supports multiple windows.
* `regexToCancelSubFramesLoading`: Regular expression used by `shouldOverrideUrlLoading` event to cancel navigation for frames that are not the main frame. If the url request of a subframe matches the regular expression, then the request of that subframe is canceled. * `regexToCancelSubFramesLoading`: Regular expression used by `shouldOverrideUrlLoading` event to cancel navigation for frames that are not the main frame. If the url request of a subframe matches the regular expression, then the request of that subframe is canceled.
* `dropDownWorkaroundEnabled`: Enable a temporary workaround for html dropdowns (`<select>` tags) (available on Android 19+). It requires **JavaScript enabled**. It attempts to block click events for the dropdowns creating a custom `<div>` layer over the dropdown to intercept user's clicks. The default value is `false`. * `dropDownWorkaroundEnabled`: Enable a temporary workaround for html dropdowns (`<select>` tags) (available on Android 19+). It requires **JavaScript enabled**. It attempts to block click events for the dropdowns creating a custom `<div>` layer over the dropdown to intercept user's clicks. This workaround is applied as soon as the web page fires the `DOMContentLoaded` JavaScript event. The default value is `false`.
##### `InAppWebView` iOS-specific options ##### `InAppWebView` iOS-specific options
......
...@@ -180,6 +180,9 @@ public class InAppWebViewClient extends WebViewClient { ...@@ -180,6 +180,9 @@ public class InAppWebViewClient extends WebViewClient {
if (webView.options.useOnLoadResource) { if (webView.options.useOnLoadResource) {
js += InAppWebView.resourceObserverJS.replaceAll("[\r\n]+", ""); js += InAppWebView.resourceObserverJS.replaceAll("[\r\n]+", "");
} }
if (webView.options.dropDownWorkaroundEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
js += InAppWebView.dropDownWorkaroundJS.replaceAll("[\r\n]+", "");
}
js += InAppWebView.printJS.replaceAll("[\r\n]+", ""); js += InAppWebView.printJS.replaceAll("[\r\n]+", "");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
...@@ -226,10 +229,6 @@ public class InAppWebViewClient extends WebViewClient { ...@@ -226,10 +229,6 @@ public class InAppWebViewClient extends WebViewClient {
String js = InAppWebView.platformReadyJS.replaceAll("[\r\n]+", ""); String js = InAppWebView.platformReadyJS.replaceAll("[\r\n]+", "");
if (webView.options.dropDownWorkaroundEnabled) {
js += InAppWebView.dropDownWorkaroundJS.replaceAll("[\r\n]+", "");
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
webView.evaluateJavascript(js, (ValueCallback<String>) null); webView.evaluateJavascript(js, (ValueCallback<String>) null);
} else { } else {
......
...@@ -410,6 +410,7 @@ class AndroidInAppWebViewOptions ...@@ -410,6 +410,7 @@ class AndroidInAppWebViewOptions
///Enable a temporary workaround for html dropdowns (`<select>` tags). It requires **JavaScript enabled**. ///Enable a temporary workaround for html dropdowns (`<select>` tags). It requires **JavaScript enabled**.
///It attempts to block click events for the dropdowns creating a custom `<div>` layer over the dropdown to intercept user's clicks. ///It attempts to block click events for the dropdowns creating a custom `<div>` layer over the dropdown to intercept user's clicks.
///This workaround is applied as soon as the web page fires the `DOMContentLoaded` JavaScript event.
///The default value is `false`. ///The default value is `false`.
/// ///
///**NOTE**: available on Android 19+. ///**NOTE**: available on Android 19+.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment