compat(android): disable native long-click on the WebView to prevent the system image context menu, closes #3629 (#3630)

This commit is contained in:
Huang Xin
2026-03-26 11:12:54 +08:00
committed by GitHub
parent f310305834
commit e2faa9ad75
@@ -30,6 +30,11 @@ class MainActivity : TauriActivity(), KeyDownInterceptor {
override fun onWebViewCreate(webView: WebView) {
wv = webView
// Disable native long-click on the WebView to prevent the system image context menu.
// On Android 8.0 (Oreo), the native image context menu can freeze the entire touch system,
// requiring a forced reboot. Text selection still works as it's handled by WebView internally.
webView.isLongClickable = false
webView.setOnLongClickListener { true }
}
private val keyEventMap = mapOf(