search: Make code in search results selectable
Created by: fkling
Solves #30002 (closed)
This makes selection possible by converting the <Link>
element to a <div>
and check inside the click event handler whether text is selected or not.
But I also kept the <Link>
element around, without content, to preserve the previous behavior:
- Instead of handling ctrl/meta+clicks ourselves, I'm letting the browser do the right thing by "forwarding" the click event to a real link.
- The link is also tabbable, thus preserving keyboard navigation (e.g. navigating to the search results when pressing enter).
- Since we don't have visual indicators for tabbing through file matches, keeping the link around will show the the URL at the bottom of the page (at least Firefox does that).
I tested it in Chromium and Firefox and didn't find any issues. Somehow needs to test it in Safari.