From f96beff94811091472f112042597d468a7b84a2f Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Fri, 8 Nov 2019 20:18:07 +0100 Subject: [PATCH] Do not show empty selection menu (#2216) --- .../org/mozilla/vrbrowser/ui/widgets/WindowWidget.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java index 7328acdd0b..bc44618bba 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java @@ -57,6 +57,7 @@ import org.mozilla.vrbrowser.ui.widgets.prompts.ConfirmPromptWidget; import org.mozilla.vrbrowser.ui.widgets.prompts.PromptWidget; import org.mozilla.vrbrowser.ui.widgets.settings.SettingsWidget; +import org.mozilla.vrbrowser.utils.StringUtils; import org.mozilla.vrbrowser.utils.SystemUtils; import org.mozilla.vrbrowser.utils.ViewUtils; @@ -1632,6 +1633,11 @@ public void onSecurityChange(GeckoSession geckoSession, SecurityInformation secu @Override public void onShowActionRequest(@NonNull GeckoSession aSession, @NonNull Selection aSelection, @NonNull String[] aActions, @NonNull GeckoResponse aResponse) { + if (StringUtils.isEmpty(aSelection.text) || (aActions.length == 1 && GeckoSession.SelectionActionDelegate.ACTION_HIDE.equals(aActions[0]))) { + // See: https://github.com/MozillaReality/FirefoxReality/issues/2214 + aResponse.respond(GeckoSession.SelectionActionDelegate.ACTION_HIDE); + return; + } TelemetryWrapper.longPressContextMenuEvent(); hideContextMenus();