diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js index 51a2285389..b7054c101d 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js @@ -195,6 +195,8 @@ ve.ui.MWMediaInsertDialog.prototype.teardown = function ( data ) { ] ).collapseRangeToEnd().select(); } + this.search.clear(); + // Parent method ve.ui.MWDialog.prototype.teardown.call( this, data ); }; diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js index 95c4d718c4..4fa811a3bf 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js @@ -407,6 +407,7 @@ ve.ui.MWReferenceDialog.prototype.teardown = function ( data ) { } } + this.search.clear(); this.referenceSurface.destroy(); this.referenceSurface = null; this.ref = null;