Upper right menu items link to current page when right-clicked

(Mittineague) #1

My name goes to my users page. But if I right-click open new tab on my avatar it goes to the current page.(as do too notifications, search, and the hamburger)

I know they’re supposed to cause a dropdown menu when left-clicked, but should / could this right-clck behavior be different?

(cpradio) #2

Such as the Avatar also going to the Profile page (maybe even the Notifications), the Search and Hamburger menu could remain as is.

(Bill Ayakatubby) #3

I’m half-tempted to recategorize as a bug. The real trouble is each of those “buttons” is really a link, and the link targets are all #. In a classic web page, that would just take you to the top of the page you’re already on, which is essentially the behavior described here. But Discourse’s scripting captures those clicks and renders drop-downs instead. That’s why you only see the problem when you try to open in a new window/tab.

A second problem is # can really mess with front-end frameworks like Ember and Angular. A third is that it’s generally bad practice and I hate it and it should DIAF. :stuck_out_tongue:

To my way of thinking, there are two possible solutions. Both of them start out the same way:

  • Change the profile button to actually link to the profile page.

Then we have a choice:

  1. Change the buttons to actually be <button type="button" />. This is the preferred option from this idealistic, anal-retentive dev’s perspective.

  2. If the buttons have to remain <a/>, change the link targets to javascript:void(0);.

(Kane York) #4

Yes, pretty much every # link is bad and needs to be replaced. I’m not working on it right now, though.

To see how many there are, run this inside of discourse/app:

$ grep -R "href=['\"]#['\"]" .

It’s quite a few.