Robbendebiene / Gesturefy

Navigate, operate, and browse faster with mouse gestures! A customizable Firefox mouse gesture add-on with a variety of different commands.
https://addons.mozilla.org/firefox/addon/gesturefy/
GNU General Public License v3.0
823 stars 74 forks source link

Open Link in New Tab works incorrectly under certain conditions #702

Open rohrsben opened 10 months ago

rohrsben commented 10 months ago

Describe your matter in detail

If user has currently highlighted text which is a valid link (eg www.google.com, but also something like spelunker.vim -- aka how I came across this) then tries to use gesture 'open link in new tab' the new tab will try to open the highlighted 'link' instead of the actual link on which the gesture was performed.

Screenshots or further assistance

Your System

harl commented 10 months ago

This “linkification” seems to be the intended behaviour when there's highlighted text that looks like a valid address. The obvious solution, programming-wise, would be to (optionally) just ignore any highlighted text, even “links/addresses”.

I'd like to mention an alternative here that I've been using for years and which practically works the same way. It's another Firefox add-on called “Hyper Drag”. There are other similar ones, but so far this one's worked best for me. It allows you to open stuff (links and images) or search for highlighted text in a new tab, by just slightly dragging them in a certain direction, without having to use separate mouse gestures or having to drag stuff directly to the address bar.

One might still need an approach to be able to search for highlighted links/addresses without actually opening them as such (e.g. doing a quick Google search on a highlighted “www.google.com”) and that's what the gesture for “Search text selection in new tab” is for. (Alternatively, Hyper Drag can do that too, calls it “Search text” as an action on dragged links)

rohrsben commented 10 months ago

I think you might be misunderstanding? If there were a site with only two pieces of a text, one a hyperlink to google.com, and the other not a link but formed like one (e.g. the spelunker.vim text from op), if you highlight the non-link then perform the Open In New Tab action on the hyperlink, the new tab will attempt to navigate to spelunker.vim, not google.com.

If the selected text is not link-like, then this doesn't occur, and google.com will open as expected. That's why I'm assuming this is unintended behaviour.

Edit: hmm, I perhaps see what you're saying. If you highlight something link-like and then perform the action on an empty part of the screen it still opens the tab. I think even with this new info, while not a bug, which "link" takes priority in the case described above is unexpected.

Robbendebiene commented 10 months ago

@rohrsben

I think you might be misunderstanding? If there were a site with only two pieces of a text, one a hyperlink to google.com, and the other not a link but formed like one (e.g. the spelunker.vim text from op), if you highlight the non-link then perform the Open In New Tab action on the hyperlink, the new tab will attempt to navigate to spelunker.vim, not google.com.

This is indeed the expected behaviour (it is also stated in the command description)

The reasoning behind this is that the chance that you select an URL in text and then try to open a real link is less likely than the other way around. Or to put it differently, it is more likely that you actually wanted to open the selected text URL and just accidentally started on a link (remember links can cover huge areas like images).

Gotta admit though that Firefox switches the priorities. Their logic seems like what you want:

IF target is link: OPEN link
ELSE IF text selection is url: OPEN selection

But one should take into account that a right click is usually performed with more accuracy than a mouse gesture.

Another solution would be to only choose the selected text over the link if the gesture actually started on the selection. However I fear that most users may prefer the current way as it is "more forgiving".

Technical references for future me:

@harl

I'd like to mention an alternative here that I've been using for years and which practically works the same way. It's another Firefox add-on called “Hyper Drag”. There are other similar ones, but so far this one's worked best for me. It allows you to open stuff (links and images) or search for highlighted text in a new tab, by just slightly dragging them in a certain direction, without having to use separate mouse gestures or having to drag stuff directly to the address bar.

Sounds like #200

I would immediately agree that it offers a better usability then "normal gestures" but I never found a good way to integrate it into Gesturefey's UI and today I might not even find the time for implementing it.