Priority/Severity :
All / Inconvenient – deffo not an emergency!
Platform :
Reproduced in Chrome on desktop and mobile
Description :
We’ve just switched over to the new ‘Header Dropdown’ navigation menu.
Our community FAQ includes a custom section to explain how the leaderboard and scoring system works with its own anchor link (/faq#waves
).
I added this link including the anchor:
Discourse strips the anchor portion and simply links to /faq
which defeats the point of tying to link directly to that section. Hoping that this isn’t intentional!
Reproducible steps :
Change navigation menu type to ‘Header Dropdown’
Add another link to /faq#civilized
Click on the menu link, instead of the specified anchor you are taken to the top of /faq
3 Me gusta
Lilly
(Lillian Louis)
16 Agosto, 2023 22:55
2
i have reproduced and i can confirm that this the case with the navigation menu custom sections in sidebar mode as well.
2 Me gusta
david
(David Taylor)
20 Marzo, 2024 15:29
6
This fix should allow anchor links to work consistently in the sidebar:
committed 12:55PM - 20 Mar 24 UTC
All our link validation, and conversion from url -> route/model/query is expensi… ve and prone to bugs. Instead, if people enter a link, we can just use it as-is.
Originally all this extra logic was added to handle unusual situations like `/safe-mode`, `/my/...`, etc. However, all of these are now handled correctly by our Ember router, so there is no need for it.
Now, we just pass the user-supplied `href` directly to the SectionLink component, and let Ember handle routing to it when clicked.
The only functional change here is that we no longer validate internal links by parsing them with the Ember router. But I'd argue this is fine, because the previous logic would cause both false positives (e.g. `/t/123` would be valid, even if topic 123 doesn't exist), and false negatives (for routes which are server-side only, like the new AI share pages).
2 Me gusta
david
(David Taylor)
Cerrado
23 Marzo, 2024 08:00
8
This topic was automatically closed after 2 days. New replies are no longer allowed.