Middle-clicking on search results should not load the link on the same page #16754
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Middle clicking is usually used for opening a link in a new tab in most browsers. It's an easy way to navigate without losing your current page.
When using rustdoc's search, I'd like to be able to middle-click on search results so that I can open multiple results in new tabs. However, currently the
onclick
listener captures middle clicks too, so link opens in two places — in a new tab, and on the same page.This partially fixes it. It would be better if the anchor tag on a result spanned the entire result path+name, and not just the name -- while normal clicking still works due to the event handler, middle clicking is broken if you click on something other than the result name (not the path). I don't mind doing it that way, but it seems like there was a reason behind having the
a
tag only cover the name. (Code pointer in case I need it in the future)