dont forward custom tab long presses

This commit is contained in:
Fabian Freund
2026-03-26 10:36:02 +01:00
parent 9e00151d24
commit b0c9d6c283
@@ -25,6 +25,7 @@ import mozilla.components.browser.state.action.LastAccessAction
import mozilla.components.browser.state.action.ReaderAction
import mozilla.components.browser.state.action.TabListAction
import mozilla.components.browser.state.action.WebExtensionAction
import mozilla.components.browser.state.selector.findCustomTab
import mozilla.components.browser.state.state.BrowserState
import mozilla.components.concept.engine.HitResult
import mozilla.components.feature.addons.logger
@@ -93,6 +94,9 @@ class FlutterEventMiddleware(private val flutterEvents: GeckoStateEvents) : Midd
}
}
is ContentAction.UpdateHitResultAction -> {
// Skip forwarding to Flutter for custom tab sessions (PWAs, TWAs),
// as they handle context menus natively via ContextMenuFeature
if (store.state.findCustomTab(action.sessionId) == null) {
runOnUiThread {
flutterEvents.onLongPress(
EventSequence.next(),
@@ -110,6 +114,7 @@ class FlutterEventMiddleware(private val flutterEvents: GeckoStateEvents) : Midd
) { _ -> }
}
}
}
is ContentAction.AddFindResultAction -> {
runOnUiThread {
flutterEvents.onFindResults(