Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] tab-clicked event not delivered to 'folder' tabs (since 4.0.24) #3653

Closed
dsl101 opened this issue Nov 5, 2024 · 7 comments
Closed

Comments

@dsl101
Copy link

dsl101 commented Nov 5, 2024

Abstract

I have a TST Extension TST Folder Expand Collapse which stopped functioning after 4.0.24 was released.

Steps to reproduce

  1. Install TST Folder Expand Collapse
  2. Create a 'folder' style tab, such as moz-extension://[TST-Extension-UUID]/resources/group-tab.html?title=Test (note these can be created by opening new tabs from pinned tabs, etc.); the TST extension id is required
  3. Click on the folder (it should expand / collapse, not activate)

Additional information

It seems this code no longer receives events from these group tabs:

async function registerToTST() {
  try {
    await browser.runtime.sendMessage(TST_ID, {
      type: 'register-self',
      name: extensionName,
      listeningTypes: [
        'ready',
        'sidebar-show',
        'tab-clicked',
        'try-move-focus-from-collapsing-tree',
      ],
      // Extra permissions to receive tab information via TST's API (works on TST 3.0.12 and later)
      permissions: [ 'tabs', 'activeTab' ],
    })
  }
  catch(e) {
    // TST is not available
  }
}

registerToTST()
browser.runtime.onMessageExternal.addListener(async (message, sender) => {

  // This code is no longer triggered when 'group' tabs are clicked on

Clicking on regular tabs does send the tab-clicked event.

Environment

  • Platform (OS): Windows
  • Version of Firefox: 132.0
  • Version (or revision) of Tree Style Tab: 4.0.24
@dsl101
Copy link
Author

dsl101 commented Nov 6, 2024

I discovered that the group 'folders' that are automatically generated include the openerTabId parameter in the URL, and if this is present, the tab-clicked message is delivered. If I copy a valid openerTabId from this group and add it to the end of an existing 'folder' tab URL, the tab-clicked message is delivered once again. But making a 'fake' one for folder tabs does not work.

So, I guess either this is by design (if so, be good to know where this is documented) and how it might be possible to work around it, to re-enable the expand / collapse feature without needing a valid openerTabId. Or it's a bug and the tab-clicked event should be delivered whether or not the group tab has an openerTabId parameter.

@dsl101
Copy link
Author

dsl101 commented Nov 6, 2024

See also #3655 and maybe related?

@piroor
Copy link
Owner

piroor commented Nov 7, 2024

I think there were some API changes in old days and your addon need to be updated for the spec of the present API.

  • The get-tree API does not give url for the tab by default due to security reason. It is recommended to use message.tab.states.includes('group-tab') to detect the clicked tab is a folder tab or not.
  • tab-clicked is notified after both tab-mousedown and tab-mouseup, but TST activates the tab just after the tab-mousedown. Thus it is recommended to cancel tab-mousedown instead of tab-clicked, to suppress tab focus certainly.

@dsl101
Copy link
Author

dsl101 commented Nov 8, 2024

Thanks for the update. On the first point, I can refactor the code to use message.tab.states.includes('group-tab') instead. But on the second, I'm not getting any events (tab-*) for group tabs. That's the root cause of the current issue. Is there some other change to get notified of mouse events on those tabs?

Or is that the other #3655 problem with group tabs causing the events to go missing?

@dsl101
Copy link
Author

dsl101 commented Nov 13, 2024

@piroor Any chance to know when the fix for #3655 will be pushed out? The github releases seems quite a way behind the Mozilla AMO releases now... I'd love to test whether that fix solves the event delivery problem here before trying to fix the other issues in this extension.

@irvinm
Copy link
Contributor

irvinm commented Nov 13, 2024

@dsl101 you can grab the latest XPI under the "actions" tab (https://github.com/piroor/treestyletab/actions). Just click on the latest check-in, grab the XPI, load it in Firefox Developer or Firefox Nightly once you set xpinstall.signatures.required = false in about:config.

BTW, I already tested #3655 with this method and it works. (I closed #3655)

@dsl101
Copy link
Author

dsl101 commented Nov 14, 2024

Ah, thanks. Not a big github user :). And can confirm the latest xpi does deliver group tab events to my extension again, so assume that's what was at the root. Now on with the other changes...

@dsl101 dsl101 closed this as completed Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants