diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java index 1152ac4af..cb054afdb 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java @@ -395,11 +395,6 @@ private void updateUI() { mBinding.navigationBarNavigation.urlBar.setDelegate(this); - if (mVoiceSearchWidget != null) { - mVoiceSearchWidget.releaseWidget(); - mVoiceSearchWidget = null; - } - if (mAttachedWindow != null) { mBinding.navigationBarNavigation.urlBar.attachToWindow(mAttachedWindow); } @@ -965,6 +960,11 @@ public void onVoiceSearchClicked() { if (mVoiceSearchWidget == null) { mVoiceSearchWidget = new VoiceSearchWidget(getContext()); mVoiceSearchWidget.setDelegate(this); + mVoiceSearchWidget.setDelegate(() -> { + mVoiceSearchWidget.hide(UIWidget.REMOVE_WIDGET); + mVoiceSearchWidget.releaseWidget(); + mVoiceSearchWidget = null; + }); } mVoiceSearchWidget.getPlacement().parentHandle = mAttachedWindow.getHandle();