web-monitoring-ui icon indicating copy to clipboard operation
web-monitoring-ui copied to clipboard

Intra-page links should not open in a new tab/window

Open Mr0grog opened this issue 5 years ago • 2 comments

In #405 we made links open in new browser tabs/windows rather than navigating the diff view. That was a good improvement, but it also happens when clicking intra-page links, like the “Proposed Changes - A Holistic Approach to Closure Part B” link here:

https://monitoring.envirodatagov.org/page/c7a491b7-b296-4bdf-965e-372a87a7ac05/6f12e08a-a7f7-4ed1-8775-8c3791614fba..1fdefab4-bf6e-4829-892a-32c35466ae3d

That link should really just scroll down the page.

To fix this, we probably just need to check whether the href starts with # before adding target="_blank" to a link here: https://github.com/edgi-govdata-archiving/web-monitoring-ui/blob/3ed21c2f17d5d3717a693888b0707f79b3e0aa71/src/scripts/html-transforms.js#L51-L68

Mr0grog avatar Feb 25 '20 16:02 Mr0grog

Update: this also applies to javascript: links!

Mr0grog avatar Mar 17 '20 23:03 Mr0grog

I'll take this @Mr0grog

SYU15 avatar Apr 03 '20 01:04 SYU15