hackmdio / hackmd-io-issues

Reporting issues about HackMD Enterprise Edition and HackMD.io
36 stars 8 forks source link

Link to another note in the same book opens in a new tab in Chrome. #170

Open benabraham opened 4 years ago

benabraham commented 4 years ago

Is this a hackmd.io issue?

What's the problem

Current behaviour

  1. Go to https://hackmd.io/@benabraham/book-example/
  2. Open any link on the right side: link in “Go to Page B” etc.
  3. Link opens in a new tab (most of the time).

video15

Sources

Expected behaviour

I expect note to open in the same tab and in the right pane of the book: the same it works in both the latest Firefox and Edge 18 because links have exactly the same URL as in the „book“.

Environment

I use HackMD on Desktop

This behavior is also visible in:

and mobile

Additional context

I tested it using a clean user profile (everything is default, no extensions except Google's default for offline Docs use).

reagle commented 4 years ago

I suspect this behavior (always open links in a new tab, except links in a book frame) is the default/expected. See "Does clicking on a link always require a new tab?" #110 .

benabraham commented 4 years ago

It should open exactly the same links inside the right pane: see https://github.com/hackmdio/codimd/issues/658

If not, it would be weird that it works in every other browser except Chrome. And in Chrome it seems to work randomly from time to time…

reagle commented 4 years ago

You are correct, no no tabs on Firefox. My theory at the time is that Firefox ignores _target directives, but I don't know...

benabraham commented 4 years ago

No, it works. Check yourself. https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/target

To me it seems that the JavaScript that changes that behavior has a bug in Chrome.