Close the notification drop-down after clicking a link
authorAlexander Ebert <ebert@woltlab.com>
Sat, 15 Aug 2020 18:04:03 +0000 (20:04 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 15 Aug 2020 18:04:03 +0000 (20:04 +0200)
This prevents the drop-down from staying open if the link is _effectively_ a no-op that does not cause a navigation, such as when the link target is the current page.

wcfsetup/install/files/js/WCF.User.js

index df99e45f7e8e017061e864473779af1be60134c9..bbecb3611d5ccd5fcafe0ce4ece39d16736a03d4 100644 (file)
@@ -617,6 +617,16 @@ if (COMPILER_TARGET_DEFAULT) {
                        }
                        
                        this.updateBadge(count);
+               },
+               
+               _success: function(data) {
+                       this._super(data);
+                       
+                       elBySelAll('.interactiveDropdownItemShadowLink', this._dropdown.getItemList()[0], (function (link) {
+                               link.addEventListener('click', (function (event) {
+                                       this._dropdown.close();
+                               }).bind(this));
+                       }.bind(this)));
                }
        });