Clicking on a post in nice reply badges opens user card, not post

AI-generated summary

A bug has been reported where clicking on a post within the ‘Nice Reply’ badge (and similar badges) opens the user card instead of the intended post. pfaffman first identified the issue on Meta, which was confirmed by JammyDodger on a test site. Firepup650 noted the same behavior with the ‘Bug Reporter’ badge. JammyDodger and Lilly observed that the issue affects all badges with linked posts. The root cause is that the entire badge card is wrapped in a link to the user card, which overrides the inner post links. pfaffman suggested a fix by adjusting the HTML structure in the user-info.hbs template but acknowledged it’s complex. The issue was acknowledged by awesomerobot, who confirmed it will be fixed in a forthcoming pull request.

Repro: visit Discourse Meta click on a post. See my usercard, even though mouseover shows the correct post URL.

I think this might be a meta-only issue.

5 Likes

I can repro it on my test site too, so not just here unfortunately.

3 Likes

The same applies to the bug reporter badge here.

I think it may be all of the ones with a post linked in them.

4 Likes

the link in the code even works as expected. :thinking:

I can also reproduce this on my dev instance. Any badge with a link.

It appears to be because the whole badge card is a link to the user card and it’s overriding the inner links (instead of just the user avatar being a card link).

1 Like

Because the initial <a> includes the whole badge info:

Well, you can fix it by closing this <a> at line 17

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-info.hbs#L1-L16

But that’s no good if there is no avatar for some reason. I think the “right” place to put it is before the first set of plugin outlets, but those are inside of a <div>, so it’s not trivial enough for me to fix, which I was hoping to do for Hacktoberfest. :crying_cat_face:

2 Likes

Thanks for reporting it! I was trying to reduce link repetition for screen readers but needed to take a different approach because I overlooked these badge links. Will be fixed by

https://github.com/discourse/discourse/pull/23783

5 Likes

This topic was automatically closed after 25 hours. New replies are no longer allowed.