haskell-code-explorer icon indicating copy to clipboard operation
haskell-code-explorer copied to clipboard

No "open in new tab" option after right clicking an identifier

Open seagreen opened this issue 5 years ago • 4 comments

Right click followed by "open in new tab" works for me for the files in the sidebar, but not for identifiers. Instead I see: screenshot

seagreen avatar Mar 24 '19 21:03 seagreen

The top of "distDir" is cut off due to an Ubuntu screenshotting issue, not the fault of haskell-code-explorer.

seagreen avatar Mar 24 '19 21:03 seagreen

There is no "Open Link in New Tab" in the context menu because each identifier (e.g., distDir) is a span HTML element, not an anchor.

A click on an identifier is handled by JavaScript: https://github.com/alexwl/haskell-code-explorer/blob/08ec8a00a18f8f900dac9be472501021d118f1d8/javascript/app/utils/go-to-definition.js#L37-L85

  • Left mouse click on an identifier updates the current browser tab.
  • Middle mouse click on an identifier opens a new browser tab (that tab may be blocked by a popup blocker).
  • There is no handler for the "right mouse click" event.

alexwl avatar Mar 26 '19 13:03 alexwl

There is no "Open Link in New Tab" in the context menu because each identifier (e.g., distDir) is a span HTML element, not an anchor.

Is there a technical reason this has to be the case, or is it arbitrary? If the former it might still be nice to switch them to anchors at some point, because not everyone will know that they can middle click to get a new tab. Not a big deal though.

seagreen avatar Mar 29 '19 22:03 seagreen

not everyone will know that they can middle click to get a new tab

I agree. Middle mouse click on an identifier is a rather obscure feature. I'll think about adding a JavaScript context menu (which opens with a right click on an identifier) with an "Open in new tab" button.

Is there a technical reason this has to be the case, or is it arbitrary?

It is mostly for convenience. Each token (clickable and non-clickable) in the source code is just a span.

There is no technical reason why Haskell identifiers can't be anchors.

alexwl avatar Mar 31 '19 21:03 alexwl