FIX: Close navigation dropdown when item selected (#12155)

FIX: Close navigation dropdown when item selected (#12155)

This if statement was backwards, such that it was a no-op. This hasn’t caused a problem because clicking an item triggers a page load, which destroys and recreates the component.

However, we are soon planning to remove the intermediate loading screen, which means the component will not be removed/recreated.

https://meta.discourse.org/t/177939/202

diff --git a/app/assets/javascripts/discourse/app/components/navigation-bar.js b/app/assets/javascripts/discourse/app/components/navigation-bar.js
index 8cd0463..5c354a8 100644
--- a/app/assets/javascripts/discourse/app/components/navigation-bar.js
+++ b/app/assets/javascripts/discourse/app/components/navigation-bar.js
@@ -52,7 +52,7 @@ export default Component.extend(FilterModeMixin, {
   },
 
   ensureDropClosed() {
-    if (!this.expanded) {
+    if (this.expanded) {
       this.set("expanded", false);
     }
     $(window).off("click.navigation-bar");

GitHub sha: 863c7919

This commit appears in #12155 which was approved by CvX. It was merged by davidtaylorhq.

This commit has been mentioned on Discourse Meta. There might be relevant details there: