Tab position

Issue #82 closed
SH created an issue

I switched to SelectionSK, because I run into problems with Swift Selection Search (the pop-up does not open). I have to say, that I like this SelectionSK very much!

I have a similar request to #63: For Swift Selection Search I have enabled: Open in new tab and the tab is opened as child of the current tab. The same happens, if I middle click on a tab.

With SelectionSK, the new tab is opened as last tab on the same level (which can sometimes be far away).

Is there a way to configure SelectionSK, that the tab opened at the same position as used with the middle mouse button?

Firefox 94.0 (64-bit)
Linux Mint 20.2
SelectionSK 5.6, downloaded from Firefox's add-on page

Comments (11)

  1. Andrey Shemetov repo owner

    SelectionSK always open a new tab next to the active tab (doesn’t make much sense to open it as a last tab). There is no logic in the code to open a new tab as a last one.

    I guess there is an interference with some other extensions or OS\Browser specific behavior.

    I checked the behavior in FF and Chrome on Win7 and Win10, works as expected. Will check MacOS later on.

    Do you have Chome installed? If yes, can you please install SSK and check behavior under Chrome?

  2. SH reporter

    Perhaps this is the reason for the current behaviour:

    I use Sidebery` and have the following settings:

    • Position of new tab > Place new tab opened from another tab: last child
    • Place new tab (for other cases): panel end

    This results in the following behaviour:

    • If I middle click on a link (or right click on it and choose Open link in new tab), the new tab is opened as a child and positioned at the end of already existing children.
    • If I open a new empty tab (Ctrl-T), a new tab is opened at the top level and positioned at the end.
    • If a tab is opened from an external program, it is opened at the top level and positioned at the end.

    I select some text and click on a search engine. The tab is opened at the panel end and not as last child as I would expect.

    It looks to me, that SelectionSK opens a new tab not a child tab. Could that be the case for the somewhat unexpected behaviour?

  3. Andrey Shemetov repo owner

    Can you please disable 'Sidebery' for a moment and check how tabs are behaving?

    Btw, API doesn’t have a concept of 'child' tab. New tab can be opened in any position, most common ones are next one or last one. Other extensions may override the behavior.

  4. SH reporter

    I only installed SelectionSK and the tab gets opened next to existing tab (as it is done with a middle click on a link or from the right-click menu Open Link in New Tab).

    I know, that Swift Selection Search opens the search page next to the existing tab.

    Sideberry also opens a new tab opened from another tab next to the existing tab, but if it opens a tab not from the existing tab as last tab.

    The only difference I can see, is that Swift Selection Search opens the new search tab from the currently active tab, but SelectionSK as a plain new tab. Is that possible?

  5. SH reporter

    I might have found the cause of it … (but please bear in mind, that I do not know much about JavaScript and even less about programming for Firefox):

    1. This is, how Sidebery is dealing with opening the tab: https://github.com/CanisLupus/swift-selection-search/blob/5332ec2a70d0a3208033fff58941096b46bcb973/src/swift-selection-search.ts#L1387, but before that it sets the openerTabId option in https://github.com/CanisLupus/swift-selection-search/blob/5332ec2a70d0a3208033fff58941096b46bcb973/src/swift-selection-search.ts#L1376
    2. According to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create#parameters : ‘If specified, the opener tab must be in the same window as the newly created tab.’
    3. I greped through SelectionSK's source, but could not identify the openerTabId option anywhere.

    Maybe it is just a matter to add this option to the call which opens the new tab?

  6. SH reporter

    So many thanks, Andrey! That looks good. I updated the add-on and now the new tab opens as child as set by Sidebery.

  7. Log in to comment