atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.64k stars 404 forks source link

Clicking links on internal pages spawns new window #3370

Closed aadcg closed 1 week ago

aadcg commented 3 months ago

The behaviour should be the same as in the GTK port.

aadcg commented 1 week ago

The root of the issue is that when setting the target attribute of anchor elements to _blank results in inconsistent behaviour between the WebKitGTK and Electron ports. In the former, the URL is loaded in a new buffer while, in the latter, in a new window.

Recently (see PR https://github.com/electron/electron/pull/41432), a way to tweak the behaviour has been introduced for Electron 31 but our port only works for version 29.

On the other hand, we should question whether the use of this attribute value is justified. At bookmarks-panel it is, otherwise the bookmarks would be opened in the panel buffer. In the context of macro-edit-mode too, since it seems reasonable to open a help page in a new context (be it a buffer or window). However, in the context of :nxref, it is questionable. Currently, a new buffer is created each time the user clicks on a "nxref" link. That means that it's hard to go backwards/forwards between these help pages.

I conclude that the right way to proceed is to change the default target attribute in the context of nxref.