diff --git a/app/assets/javascripts/discourse/initializers/d-popover.js.es6 b/app/assets/javascripts/discourse/initializers/d-popover.js.es6 index 0fae353b8b2..d27837da32b 100644 --- a/app/assets/javascripts/discourse/initializers/d-popover.js.es6 +++ b/app/assets/javascripts/discourse/initializers/d-popover.js.es6 @@ -6,7 +6,10 @@ const SELECTORS = export default { name: "d-popover", - initialize() { + initialize(container) { + const router = container.lookup("router:main"); + router.on("routeWillChange", hidePopover); + $("#main").on("click.d-popover mouseenter.d-popover", SELECTORS, event => showPopover(event) );